Real Testimonials - Version 2.2.19

Version Description

  • Sep 16, 2021 =
  • Improved: Plugin security.
  • Removed: Unused code.
Download this release

Release Info

Developer shapedplugin
Plugin Icon 128x128 Real Testimonials
Version 2.2.19
Comparing to
See all releases

Code changes from version 2.2.18 to 2.2.19

Files changed (86) hide show
  1. admin/views/framework/classes/abstract.class.php +60 -23
  2. admin/views/framework/classes/customize-options.class.php +393 -266
  3. admin/views/framework/classes/fields.class.php +76 -17
  4. admin/views/framework/classes/metabox.class.php +146 -57
  5. admin/views/framework/classes/options.class.php +215 -74
  6. admin/views/framework/classes/setup.class.php +205 -68
  7. admin/views/framework/classes/widgets.class.php +168 -107
  8. admin/views/framework/fields/accordion/accordion.php +38 -13
  9. admin/views/framework/fields/background/background.php +0 -332
  10. admin/views/framework/fields/backup/backup.php +0 -42
  11. admin/views/framework/fields/border/border.php +170 -142
  12. admin/views/framework/fields/button_set/button_set.php +43 -17
  13. admin/views/framework/fields/checkbox/checkbox.php +106 -76
  14. admin/views/framework/fields/code_editor/code_editor.php +90 -42
  15. admin/views/framework/fields/color/color.php +70 -35
  16. admin/views/framework/fields/color_group/color_group.php +53 -27
  17. admin/views/framework/fields/column/column.php +40 -14
  18. admin/views/framework/fields/content/content.php +0 -22
  19. admin/views/framework/fields/custom_import/custom_import.php +36 -10
  20. admin/views/framework/fields/custom_size/custom_size.php +50 -25
  21. admin/views/framework/fields/date/date.php +0 -64
  22. admin/views/framework/fields/dimensions/dimensions.php +0 -101
  23. admin/views/framework/fields/fieldset/fieldset.php +0 -41
  24. admin/views/framework/fields/form_upper_section/form_upper_section.php +33 -7
  25. admin/views/framework/fields/gallery/gallery.php +0 -53
  26. admin/views/framework/fields/group/group.php +0 -145
  27. admin/views/framework/fields/heading/heading.php +0 -24
  28. admin/views/framework/fields/icon_select/icon_select.php +42 -16
  29. admin/views/framework/fields/image_select/image_select.php +41 -14
  30. admin/views/framework/fields/image_sizes/image_sizes.php +46 -18
  31. admin/views/framework/fields/link_color/link_color.php +0 -91
  32. admin/views/framework/fields/map/map.php +0 -99
  33. admin/views/framework/fields/media/media.php +0 -86
  34. admin/views/framework/fields/notice/notice.php +33 -8
  35. admin/views/framework/fields/number/number.php +0 -61
  36. admin/views/framework/fields/palette/palette.php +0 -60
  37. admin/views/framework/fields/radio/radio.php +101 -70
  38. admin/views/framework/fields/rating/rating.php +41 -11
  39. admin/views/framework/fields/repeater/repeater.php +108 -75
  40. admin/views/framework/fields/select/select.php +153 -118
  41. admin/views/framework/fields/select_f/select_f.php +48 -21
  42. admin/views/framework/fields/shortcode/shortcode.php +35 -8
  43. admin/views/framework/fields/slider/slider.php +0 -78
  44. admin/views/framework/fields/sortable/sortable.php +78 -49
  45. admin/views/framework/fields/sorter/sorter.php +0 -75
  46. admin/views/framework/fields/spacing/spacing.php +168 -136
  47. admin/views/framework/fields/spinner/spinner.php +88 -48
  48. admin/views/framework/fields/subheading/subheading.php +40 -14
  49. admin/views/framework/fields/submessage/submessage.php +41 -15
  50. admin/views/framework/fields/switcher/switcher.php +54 -27
  51. admin/views/framework/fields/tabbed/tabbed.php +0 -64
  52. admin/views/framework/fields/text/text.php +50 -24
  53. admin/views/framework/fields/text_f/text_f.php +0 -28
  54. admin/views/framework/fields/textarea/textarea.php +0 -25
  55. admin/views/framework/fields/typography/google-fonts.php +12 -1
  56. admin/views/framework/fields/typography/typography.php +141 -97
  57. admin/views/framework/fields/upload/upload.php +0 -41
  58. admin/views/framework/fields/wp_editor/wp_editor.php +0 -103
  59. admin/views/framework/functions/actions.php +54 -101
  60. admin/views/framework/functions/customize.php +156 -107
  61. admin/views/framework/functions/deprecated.php +13 -2
  62. admin/views/framework/functions/helpers.php +100 -89
  63. admin/views/framework/functions/sanitize.php +42 -22
  64. admin/views/framework/functions/validate.php +151 -130
  65. admin/views/mce-button.php +96 -53
  66. admin/views/notices/review.php +19 -3
  67. admin/views/scripts.php +13 -0
  68. admin/views/testimonial-form.php +12 -172
  69. admin/views/testimonial-metaboxs.php +18 -4
  70. admin/views/testimonial-settings.php +15 -22
  71. admin/views/testimonial-tools.php +13 -2
  72. admin/views/widget.php +56 -23
  73. class/router.php +14 -3
  74. class/shortcodes.php +11 -4
  75. class/testimonial.php +39 -13
  76. includes/class-testimonial-import-export.php +18 -14
  77. includes/custom-css.php +10 -0
  78. includes/free/loader.php +10 -2
  79. includes/functions.php +131 -97
  80. public/views/deprecated-shortcodes.php +22 -6
  81. public/views/schema.php +10 -0
  82. public/views/scripts.php +14 -1
  83. public/views/shortcoderender.php +44 -15
  84. public/views/templates/theme-one.php +2 -0
  85. readme.txt +5 -1
  86. testimonial-free.php +58 -44
admin/views/framework/classes/abstract.class.php CHANGED
@@ -1,37 +1,74 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Abstract Class
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Abstract' ) ) {
11
- abstract class SPFTESTIMONIAL_Abstract {
12
 
13
- public $abstract = '';
14
- public $output_css = '';
15
- public $typographies = array();
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- // Check for embed custom css styles
20
- if( ! empty( $this->args['output_css'] ) ) {
21
- add_action( 'wp_head', array( &$this, 'add_output_css' ), 100 );
22
- }
23
 
24
- }
 
 
 
25
 
26
- public function add_output_css() {
27
 
28
- $this->output_css = apply_filters( "spftestimonial_{$this->unique}_output_css", $this->output_css, $this );
 
 
 
 
 
29
 
30
- if ( ! empty( $this->output_css ) ) {
31
- echo '<style type="text/css">'. $this->output_css . '</style>';
32
- }
33
 
34
- }
 
 
35
 
36
- }
 
 
37
  }
 
1
+ <?php
2
  /**
3
+ * Framework abstract.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'SPFTESTIMONIAL_Abstract' ) ) {
17
+ /**
18
+ *
19
+ * Abstract Class
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ abstract class SPFTESTIMONIAL_Abstract {
25
 
26
+ /**
27
+ * $abstract variable
28
+ *
29
+ * @var string
30
+ */
31
+ public $abstract = '';
32
+ /**
33
+ * $output_css variable
34
+ *
35
+ * @var string
36
+ */
37
+ public $output_css = '';
38
+ /**
39
+ * $typographies variable
40
+ *
41
+ * @var array
42
+ */
43
+ public $typographies = array();
44
 
45
+ /**
46
+ * Constructor of the class.
47
+ */
48
+ public function __construct() {
49
 
50
+ // Check for embed custom css styles.
51
+ if ( ! empty( $this->args['output_css'] ) ) {
52
+ add_action( 'wp_head', array( &$this, 'add_output_css' ), 100 );
53
+ }
54
 
55
+ }
56
 
57
+ /**
58
+ * Add output CSS.
59
+ *
60
+ * @return void
61
+ */
62
+ public function add_output_css() {
63
 
64
+ $this->output_css = apply_filters( "spftestimonial_{$this->unique}_output_css", $this->output_css, $this );
 
 
65
 
66
+ if ( ! empty( $this->output_css ) ) {
67
+ echo '<style type="text/css">' . wp_strip_all_tags( $this->output_css ) . '</style>'; // phpcs:ignore
68
+ }
69
 
70
+ }
71
+
72
+ }
73
  }
74
+
admin/views/framework/classes/customize-options.class.php CHANGED
@@ -1,279 +1,406 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Customize Options Class
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Customize_Options' ) ) {
11
- class SPFTESTIMONIAL_Customize_Options extends SPFTESTIMONIAL_Abstract {
12
-
13
- // constans
14
- public $unique = '';
15
- public $abstract = 'customize';
16
- public $options = array();
17
- public $sections = array();
18
- public $pre_fields = array();
19
- public $pre_tabs = array();
20
- public $priority = 10;
21
- public $args = array(
22
- 'database' => 'option',
23
- 'transport' => 'refresh',
24
- 'capability' => 'manage_options',
25
- 'save_defaults' => true,
26
- 'enqueue_webfont' => true,
27
- 'async_webfont' => false,
28
- 'output_css' => true,
29
- 'defaults' => array()
30
- );
31
-
32
- // run customize construct
33
- public function __construct( $key, $params ) {
34
-
35
- $this->unique = $key;
36
- $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
37
- $this->sections = apply_filters( "spftestimonial_{$this->unique}_sections", $params['sections'], $this );
38
- $this->pre_fields = $this->pre_fields( $this->sections );
39
-
40
- $this->get_options();
41
- $this->save_defaults();
42
-
43
- add_action( 'customize_register', array( &$this, 'add_customize_options' ) );
44
- add_action( 'customize_save_after', array( &$this, 'add_customize_save_after' ) );
45
-
46
- // Get options for enqueue actions
47
- if( is_customize_preview() ) {
48
- add_action( 'wp_enqueue_scripts', array( &$this, 'get_options' ) );
49
- }
50
-
51
- // wp enqeueu for typography and output css
52
- parent::__construct();
53
-
54
- }
55
-
56
- // instance
57
- public static function instance( $key, $params = array() ) {
58
- return new self( $key, $params );
59
- }
60
-
61
- public function add_customize_save_after( $wp_customize ) {
62
- do_action( "spftestimonial_{$this->unique}_save_before", $this->get_options(), $this, $wp_customize );
63
- do_action( "spftestimonial_{$this->unique}_saved", $this->get_options(), $this, $wp_customize );
64
- do_action( "spftestimonial_{$this->unique}_save_after", $this->get_options(), $this, $wp_customize );
65
- }
66
-
67
- // get default value
68
- public function get_default( $field ) {
69
-
70
- $default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : null;
71
- $default = ( isset( $field['default'] ) ) ? $field['default'] : $default;
72
-
73
- return $default;
74
-
75
- }
76
-
77
- // get option
78
- public function get_options() {
79
-
80
- if( $this->args['database'] === 'theme_mod' ) {
81
- $this->options = get_theme_mod( $this->unique, array() );
82
- } else {
83
- $this->options = get_option( $this->unique, array() );
84
- }
85
-
86
- if( empty( $this->options ) ) {
87
- $this->options = array();
88
- }
89
-
90
- return $this->options;
91
-
92
- }
93
-
94
- // save defaults and set new fields value to main options
95
- public function save_defaults() {
96
-
97
- $tmp_options = $this->options;
98
-
99
- if( ! empty( $this->pre_fields ) ) {
100
- foreach( $this->pre_fields as $field ) {
101
- if( ! empty( $field['id'] ) ) {
102
- $this->options[$field['id']] = ( isset( $this->options[$field['id']] ) ) ? $this->options[$field['id']] : $this->get_default( $field );
103
- }
104
- }
105
- }
106
-
107
- if( $this->args['save_defaults'] && empty( $this->args['show_in_customizer'] ) && empty( $tmp_options ) ) {
108
-
109
- if( $this->args['database'] === 'theme_mod' ) {
110
- set_theme_mod( $this->unique, $this->options );
111
- } else {
112
- update_option( $this->unique, $this->options );
113
- }
114
-
115
- }
116
-
117
- }
118
-
119
- public function pre_fields( $sections ) {
120
-
121
- $result = array();
122
-
123
- foreach( $sections as $key => $section ) {
124
- if( ! empty( $section['fields'] ) ) {
125
- foreach( $section['fields'] as $field ) {
126
- $result[] = $field;
127
- }
128
- }
129
- }
130
-
131
- return $result;
132
- }
133
-
134
-
135
- public function pre_tabs( $sections ) {
136
-
137
- $result = array();
138
- $parents = array();
139
-
140
- foreach( $sections as $key => $section ) {
141
- if( ! empty( $section['parent'] ) ) {
142
- $parents[$section['parent']][] = $section;
143
- unset( $sections[$key] );
144
- }
145
- }
146
-
147
- foreach( $sections as $key => $section ) {
148
- if( ! empty( $section['id'] ) && ! empty( $parents[$section['id']] ) ) {
149
- $section['subs'] = $parents[$section['id']];
150
- }
151
- $result[] = $section;
152
- }
153
-
154
- return $result;
155
-
156
- }
157
-
158
- public function add_customize_options( $wp_customize ) {
159
-
160
- if( ! class_exists( 'WP_Customize_Panel_SPFTESTIMONIAL' ) ) {
161
- SPFTESTIMONIAL::include_plugin_file( 'functions/customize.php' );
162
- }
163
-
164
- if( ! empty( $this->sections ) ) {
165
-
166
- $sections = $this->pre_tabs( $this->sections );
167
-
168
- foreach( $sections as $section ) {
169
-
170
- if( ! empty( $section['subs'] ) ) {
171
-
172
- $panel_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique .'-panel-'. $this->priority;
173
-
174
- $wp_customize->add_panel( new WP_Customize_Panel_SPFTESTIMONIAL( $wp_customize, $panel_id, array(
175
- 'title' => ( isset( $section['title'] ) ) ? $section['title'] : null,
176
- 'description' => ( isset( $section['description'] ) ) ? $section['description'] : null,
177
- 'priority' => ( isset( $section['priority'] ) ) ? $section['priority'] : null,
178
- ) ) );
179
-
180
- $this->priority++;
181
-
182
- foreach( $section['subs'] as $sub_section ) {
183
-
184
- $section_id = ( isset( $sub_section['id'] ) ) ? $sub_section['id'] : $this->unique .'-section-'. $this->priority;
185
-
186
- $this->add_section( $wp_customize, $section_id, $sub_section, $panel_id );
187
-
188
- $this->priority++;
189
-
190
- }
191
-
192
- } else {
193
-
194
- $section_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique .'-section-'. $this->priority;
195
-
196
- $this->add_section( $wp_customize, $section_id, $section, false );
197
-
198
- $this->priority++;
199
-
200
- }
201
-
202
- }
203
-
204
- }
205
-
206
- }
207
-
208
- // add customize section
209
- public function add_section( $wp_customize, $section_id, $section_args, $panel_id ) {
210
-
211
- if( ! empty( $section_args['assign'] ) ) {
212
-
213
- $section_id = $section_args['assign'];
214
-
215
- } else {
216
-
217
- $wp_customize->add_section( new WP_Customize_Section_SPFTESTIMONIAL( $wp_customize, $section_id, array(
218
- 'title' => ( isset( $section_args['title'] ) ) ? $section_args['title'] : null,
219
- 'description' => ( isset( $section_args['description'] ) ) ? $section_args['description'] : null,
220
- 'priority' => ( isset( $section_args['priority'] ) ) ? $section_args['priority'] : null,
221
- 'panel' => ( $panel_id ) ? $panel_id : null,
222
- ) ) );
223
-
224
- }
225
-
226
- if( ! empty( $section_args['fields'] ) ) {
227
-
228
- $field_key = 1;
229
-
230
- foreach( $section_args['fields'] as $field ) {
231
-
232
- if( isset( $field['id'] ) ) {
233
- $field['default'] = $this->get_default( $field );
234
- }
235
-
236
- $field_id = ( isset( $field['id'] ) ) ? $field['id'] : '_nonce-'. $section_id .'-'. $field_key;
237
- $setting_id = $this->unique .'['. $field_id .']';
238
- $setting_args = ( isset( $field['setting_args'] ) ) ? $field['setting_args'] : array();
239
- $control_args = ( isset( $field['control_args'] ) ) ? $field['control_args'] : array();
240
- $field_transport = ( isset( $field['transport'] ) ) ? $field['transport'] : $this->args['transport'];
241
- $field_sanitize = ( isset( $field['sanitize'] ) ) ? $field['sanitize'] : null;
242
- $field_validate = ( isset( $field['validate'] ) ) ? $field['validate'] : null;
243
- $field_default = ( isset( $field['default'] ) ) ? $field['default'] : null;
244
- $has_selective = ( isset( $field['selective_refresh'] ) && isset( $wp_customize->selective_refresh ) ) ? true : false;
245
 
246
- $wp_customize->add_setting( $setting_id,
247
- wp_parse_args( $setting_args, array(
248
- 'default' => $field_default,
249
- 'type' => $this->args['database'],
250
- 'transport' => ( $has_selective ) ? 'postMessage' : $field_transport,
251
- 'capability' => $this->args['capability'],
252
- 'sanitize_callback' => $field_sanitize,
253
- 'validate_callback' => $field_validate
254
- ) )
255
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
- $wp_customize->add_control( new WP_Customize_Control_SPFTESTIMONIAL( $wp_customize, $setting_id,
258
- wp_parse_args( $control_args, array(
259
- 'unique' => $this->unique,
260
- 'field' => $field,
261
- 'section' => $section_id,
262
- 'settings' => $setting_id
263
- ) )
264
- ) );
 
 
 
 
 
 
 
 
265
 
266
- if( $has_selective ) {
267
- $wp_customize->selective_refresh->add_partial( $setting_id, $field['selective_refresh'] );
268
- }
269
 
270
- $field_key++;
271
- }
272
 
273
- }
 
 
 
 
 
 
274
 
 
 
 
275
 
276
- }
277
 
278
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  }
1
+ <?php
2
  /**
3
+ * Framework customize-options.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'SPFTESTIMONIAL_Customize_Options' ) ) {
17
+ /**
18
+ *
19
+ * Customize Options Class
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ class SPFTESTIMONIAL_Customize_Options extends SPFTESTIMONIAL_Abstract {
25
+
26
+
27
+ /**
28
+ * Unique ID/Name
29
+ *
30
+ * @var string
31
+ */
32
+ public $unique = '';
33
+ /**
34
+ * Abstract.
35
+ *
36
+ * @var string
37
+ */
38
+ public $abstract = 'customize';
39
+ /**
40
+ * Options
41
+ *
42
+ * @var array
43
+ */
44
+ public $options = array();
45
+ /**
46
+ * Setions.
47
+ *
48
+ * @var array
49
+ */
50
+ public $sections = array();
51
+ /**
52
+ * Pre fields.
53
+ *
54
+ * @var array
55
+ */
56
+ public $pre_fields = array();
57
+ /**
58
+ * Pre tabs.
59
+ *
60
+ * @var array
61
+ */
62
+ public $pre_tabs = array();
63
+ /**
64
+ * Priority.
65
+ *
66
+ * @var array
67
+ */
68
+ public $priority = 10;
69
+ /**
70
+ * Default arguments.
71
+ *
72
+ * @var array
73
+ */
74
+ public $args = array(
75
+ 'database' => 'option',
76
+ 'transport' => 'refresh',
77
+ 'capability' => 'manage_options',
78
+ 'save_defaults' => true,
79
+ 'enqueue_webfont' => true,
80
+ 'async_webfont' => false,
81
+ 'output_css' => true,
82
+ 'defaults' => array(),
83
+ );
84
+
85
+ /**
86
+ * Run framework construct.
87
+ *
88
+ * @param string $key The filter unique key.
89
+ * @param array $params The parameters.
90
+ */
91
+ public function __construct( $key, $params ) {
92
+
93
+ $this->unique = $key;
94
+ $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
95
+ $this->sections = apply_filters( "spftestimonial_{$this->unique}_sections", $params['sections'], $this );
96
+ $this->pre_fields = $this->pre_fields( $this->sections );
97
+
98
+ $this->get_options();
99
+ $this->save_defaults();
100
+
101
+ add_action( 'customize_register', array( &$this, 'add_customize_options' ) );
102
+ add_action( 'customize_save_after', array( &$this, 'add_customize_save_after' ) );
103
+
104
+ // Get options for enqueue actions.
105
+ if ( is_customize_preview() ) {
106
+ add_action( 'wp_enqueue_scripts', array( &$this, 'get_options' ) );
107
+ }
108
+
109
+ // wp enqeueu for typography and output css.
110
+ parent::__construct();
111
+
112
+ }
113
+
114
+ /**
115
+ * Instance.
116
+ *
117
+ * @param object $key The instance key.
118
+ * @param array $params All the parameters.
119
+ * @return mixed
120
+ */
121
+ public static function instance( $key, $params = array() ) {
122
+
123
+ return new self( $key, $params );
124
+ }
125
+
126
+ /**
127
+ * Add customize save after.
128
+ *
129
+ * @param object $wp_customize Wp customize option.
130
+ * @return void
131
+ */
132
+ public function add_customize_save_after( $wp_customize ) {
133
+
134
+ do_action( "spftestimonial_{$this->unique}_save_before", $this->get_options(), $this, $wp_customize );
135
+ do_action( "spftestimonial_{$this->unique}_saved", $this->get_options(), $this, $wp_customize );
136
+ do_action( "spftestimonial_{$this->unique}_save_after", $this->get_options(), $this, $wp_customize );
137
+ }
138
+
139
+ /**
140
+ * Get default value
141
+ *
142
+ * @param array $field default field.
143
+ * @return string
144
+ */
145
+ public function get_default( $field ) {
146
+
147
+ $default = ( isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : null;
148
+ $default = ( isset( $field['default'] ) ) ? $field['default'] : $default;
149
+
150
+ return $default;
151
+
152
+ }
153
+
154
+ /**
155
+ * Get option
156
+ *
157
+ * @return object
158
+ */
159
+ public function get_options() {
160
+
161
+ if ( 'theme_mod' === $this->args['database'] ) {
162
+ $this->options = get_theme_mod( $this->unique, array() );
163
+ } else {
164
+ $this->options = get_option( $this->unique, array() );
165
+ }
166
+
167
+ if ( empty( $this->options ) ) {
168
+ $this->options = array();
169
+ }
170
+
171
+ return $this->options;
172
+
173
+ }
174
+
175
+ /**
176
+ * Save defaults and set new fields value to main options.
177
+ *
178
+ * @return void
179
+ */
180
+ public function save_defaults() {
181
+
182
+ $tmp_options = $this->options;
183
+
184
+ if ( ! empty( $this->pre_fields ) ) {
185
+ foreach ( $this->pre_fields as $field ) {
186
+ if ( ! empty( $field['id'] ) ) {
187
+ $this->options[ $field['id'] ] = ( isset( $this->options[ $field['id'] ] ) ) ? $this->options[ $field['id'] ] : $this->get_default( $field );
188
+ }
189
+ }
190
+ }
191
+
192
+ if ( $this->args['save_defaults'] && empty( $this->args['show_in_customizer'] ) && empty( $tmp_options ) ) {
193
+
194
+ if ( 'theme_mod' === $this->args['database'] ) {
195
+ set_theme_mod( $this->unique, $this->options );
196
+ } else {
197
+ update_option( $this->unique, $this->options );
198
+ }
199
+ }
200
+
201
+ }
202
+
203
+ /**
204
+ * Pre fields method.
205
+ *
206
+ * @param array $sections The sections.
207
+ * @return $result
208
+ */
209
+ public function pre_fields( $sections ) {
210
+
211
+ $result = array();
212
+
213
+ foreach ( $sections as $key => $section ) {
214
+ if ( ! empty( $section['fields'] ) ) {
215
+ foreach ( $section['fields'] as $field ) {
216
+ $result[] = $field;
217
+ }
218
+ }
219
+ }
220
+
221
+ return $result;
222
+ }
223
+
224
+ /**
225
+ * Pre tabs.
226
+ *
227
+ * @param array $sections All the sections.
228
+ * @return mixed
229
+ */
230
+ public function pre_tabs( $sections ) {
231
 
232
+ $result = array();
233
+ $parents = array();
234
+
235
+ foreach ( $sections as $key => $section ) {
236
+ if ( ! empty( $section['parent'] ) ) {
237
+ $parents[ $section['parent'] ][] = $section;
238
+ unset( $sections[ $key ] );
239
+ }
240
+ }
241
+
242
+ foreach ( $sections as $key => $section ) {
243
+ if ( ! empty( $section['id'] ) && ! empty( $parents[ $section['id'] ] ) ) {
244
+ $section['subs'] = $parents[ $section['id'] ];
245
+ }
246
+ $result[] = $section;
247
+ }
248
 
249
+ return $result;
 
 
250
 
251
+ }
 
252
 
253
+ /**
254
+ * Add customize options.
255
+ *
256
+ * @param object $wp_customize Wp customize options.
257
+ * @return void
258
+ */
259
+ public function add_customize_options( $wp_customize ) {
260
 
261
+ if ( ! class_exists( 'WP_Customize_Panel_SPFTESTIMONIAL' ) ) {
262
+ SPFTESTIMONIAL::include_plugin_file( 'functions/customize.php' );
263
+ }
264
 
265
+ if ( ! empty( $this->sections ) ) {
266
 
267
+ $sections = $this->pre_tabs( $this->sections );
268
+
269
+ foreach ( $sections as $section ) {
270
+
271
+ if ( ! empty( $section['subs'] ) ) {
272
+
273
+ $panel_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique . '-panel-' . $this->priority;
274
+
275
+ $wp_customize->add_panel(
276
+ new WP_Customize_Panel_SPFTESTIMONIAL(
277
+ $wp_customize,
278
+ $panel_id,
279
+ array(
280
+ 'title' => ( isset( $section['title'] ) ) ? $section['title'] : null,
281
+ 'description' => ( isset( $section['description'] ) ) ? $section['description'] : null,
282
+ 'priority' => ( isset( $section['priority'] ) ) ? $section['priority'] : null,
283
+ )
284
+ )
285
+ );
286
+
287
+ $this->priority++;
288
+
289
+ foreach ( $section['subs'] as $sub_section ) {
290
+
291
+ $section_id = ( isset( $sub_section['id'] ) ) ? $sub_section['id'] : $this->unique . '-section-' . $this->priority;
292
+
293
+ $this->add_section( $wp_customize, $section_id, $sub_section, $panel_id );
294
+
295
+ $this->priority++;
296
+
297
+ }
298
+ } else {
299
+
300
+ $section_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique . '-section-' . $this->priority;
301
+
302
+ $this->add_section( $wp_customize, $section_id, $section, false );
303
+
304
+ $this->priority++;
305
+
306
+ }
307
+ }
308
+ }
309
+
310
+ }
311
+
312
+ /**
313
+ * Add customize section
314
+ *
315
+ * @param object $wp_customize customize options.
316
+ * @param string $section_id section id.
317
+ * @param array $section_args section argument.
318
+ * @param int $panel_id panel id.
319
+ * @return void
320
+ */
321
+ public function add_section( $wp_customize, $section_id, $section_args, $panel_id ) {
322
+
323
+ if ( ! empty( $section_args['assign'] ) ) {
324
+
325
+ $section_id = $section_args['assign'];
326
+
327
+ } else {
328
+
329
+ $wp_customize->add_section(
330
+ new WP_Customize_Section_SPFTESTIMONIAL(
331
+ $wp_customize,
332
+ $section_id,
333
+ array(
334
+ 'title' => ( isset( $section_args['title'] ) ) ? $section_args['title'] : null,
335
+ 'description' => ( isset( $section_args['description'] ) ) ? $section_args['description'] : null,
336
+ 'priority' => ( isset( $section_args['priority'] ) ) ? $section_args['priority'] : null,
337
+ 'panel' => ( $panel_id ) ? $panel_id : null,
338
+ )
339
+ )
340
+ );
341
+
342
+ }
343
+
344
+ if ( ! empty( $section_args['fields'] ) ) {
345
+
346
+ $field_key = 1;
347
+
348
+ foreach ( $section_args['fields'] as $field ) {
349
+
350
+ if ( isset( $field['id'] ) ) {
351
+ $field['default'] = $this->get_default( $field );
352
+ }
353
+
354
+ $field_id = ( isset( $field['id'] ) ) ? $field['id'] : '_nonce-' . $section_id . '-' . $field_key;
355
+ $setting_id = $this->unique . '[' . $field_id . ']';
356
+ $setting_args = ( isset( $field['setting_args'] ) ) ? $field['setting_args'] : array();
357
+ $control_args = ( isset( $field['control_args'] ) ) ? $field['control_args'] : array();
358
+ $field_transport = ( isset( $field['transport'] ) ) ? $field['transport'] : $this->args['transport'];
359
+ $field_sanitize = ( isset( $field['sanitize'] ) ) ? $field['sanitize'] : null;
360
+ $field_validate = ( isset( $field['validate'] ) ) ? $field['validate'] : null;
361
+ $field_default = ( isset( $field['default'] ) ) ? $field['default'] : null;
362
+ $has_selective = ( isset( $field['selective_refresh'] ) && isset( $wp_customize->selective_refresh ) ) ? true : false;
363
+
364
+ $wp_customize->add_setting(
365
+ $setting_id,
366
+ wp_parse_args(
367
+ $setting_args,
368
+ array(
369
+ 'default' => $field_default,
370
+ 'type' => $this->args['database'],
371
+ 'transport' => ( $has_selective ) ? 'postMessage' : $field_transport,
372
+ 'capability' => $this->args['capability'],
373
+ 'sanitize_callback' => $field_sanitize,
374
+ 'validate_callback' => $field_validate,
375
+ )
376
+ )
377
+ );
378
+
379
+ $wp_customize->add_control(
380
+ new WP_Customize_Control_SPFTESTIMONIAL(
381
+ $wp_customize,
382
+ $setting_id,
383
+ wp_parse_args(
384
+ $control_args,
385
+ array(
386
+ 'unique' => $this->unique,
387
+ 'field' => $field,
388
+ 'section' => $section_id,
389
+ 'settings' => $setting_id,
390
+ )
391
+ )
392
+ )
393
+ );
394
+
395
+ if ( $has_selective ) {
396
+ $wp_customize->selective_refresh->add_partial( $setting_id, $field['selective_refresh'] );
397
+ }
398
+
399
+ $field_key++;
400
+ }
401
+ }
402
+
403
+ }
404
+
405
+ }
406
  }
admin/views/framework/classes/fields.class.php CHANGED
@@ -1,17 +1,37 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Fields Class
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
 
 
 
 
 
 
 
12
  abstract class SPFTESTIMONIAL_Fields extends SPFTESTIMONIAL_Abstract {
13
 
14
-
 
 
 
 
 
 
 
 
15
  public function __construct( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
  $this->field = $field;
@@ -21,6 +41,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
21
  $this->parent = $parent;
22
  }
23
 
 
 
 
 
 
 
24
  public function field_name( $nested_name = '' ) {
25
 
26
  $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
@@ -36,6 +62,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
36
 
37
  }
38
 
 
 
 
 
 
 
39
  public function field_attributes( $custom_atts = array() ) {
40
 
41
  $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
@@ -55,10 +87,10 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
55
 
56
  if ( ! empty( $attributes ) ) {
57
  foreach ( $attributes as $key => $value ) {
58
- if ( $value === 'only-key' ) {
59
- $atts .= ' ' . $key;
60
  } else {
61
- $atts .= ' ' . $key . '="' . $value . '"';
62
  }
63
  }
64
  }
@@ -67,10 +99,20 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
67
 
68
  }
69
 
 
 
 
 
 
70
  public function field_before() {
71
  return ( ! empty( $this->field['before'] ) ) ? $this->field['before'] : '';
72
  }
73
 
 
 
 
 
 
74
  public function field_after() {
75
 
76
  $output = ( ! empty( $this->field['after'] ) ) ? $this->field['after'] : '';
@@ -82,21 +124,30 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
82
 
83
  }
84
 
 
 
 
 
 
 
 
 
 
85
  public static function field_data( $type = '', $term = false, $query_args = array() ) {
86
 
87
  $options = array();
88
  $array_search = false;
89
 
90
  // sanitize type name.
91
- if ( in_array( $type, array( 'page', 'pages' ) ) ) {
92
  $option = 'page';
93
- } elseif ( in_array( $type, array( 'post', 'posts' ) ) ) {
94
  $option = 'post';
95
- } elseif ( in_array( $type, array( 'category', 'categories' ) ) ) {
96
  $option = 'category';
97
- } elseif ( in_array( $type, array( 'tag', 'tags' ) ) ) {
98
  $option = 'post_tag';
99
- } elseif ( in_array( $type, array( 'menu', 'menus' ) ) ) {
100
  $option = 'nav_menu';
101
  } else {
102
  $option = '';
@@ -323,6 +374,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
323
 
324
  }
325
 
 
 
 
 
 
 
 
 
326
  public function field_wp_query_data_title( $type, $values ) {
327
 
328
  $options = array();
@@ -381,7 +440,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
381
 
382
  case 'role':
383
  case 'roles':
384
- global $wp_roles;
385
 
386
  if ( ! empty( $wp_roles ) && ! empty( $wp_roles->roles ) && ! empty( $wp_roles->roles[ $value ] ) ) {
387
  $options[ $value ] = $wp_roles->roles[ $value ]['name'];
@@ -391,7 +450,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
391
 
392
  case 'post_type':
393
  case 'post_types':
394
- $post_types = get_post_types( array( 'show_in_nav_menus' => true ) );
395
 
396
  if ( ! is_wp_error( $post_types ) && ! empty( $post_types ) && ! empty( $post_types[ $value ] ) ) {
397
  $options[ $value ] = ucfirst( $value );
1
+ <?php
 
 
2
  /**
3
+ * Framework fields.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
17
+ /**
18
+ *
19
+ * Fields Class
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
  abstract class SPFTESTIMONIAL_Fields extends SPFTESTIMONIAL_Abstract {
25
 
26
+ /**
27
+ * Field class constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
  public function __construct( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
36
 
37
  $this->field = $field;
41
  $this->parent = $parent;
42
  }
43
 
44
+ /**
45
+ * Field name method.
46
+ *
47
+ * @param string $nested_name Nested field name.
48
+ * @return string
49
+ */
50
  public function field_name( $nested_name = '' ) {
51
 
52
  $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
62
 
63
  }
64
 
65
+ /**
66
+ * Field attributes.
67
+ *
68
+ * @param array $custom_atts Custom attributes.
69
+ * @return mixed
70
+ */
71
  public function field_attributes( $custom_atts = array() ) {
72
 
73
  $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
87
 
88
  if ( ! empty( $attributes ) ) {
89
  foreach ( $attributes as $key => $value ) {
90
+ if ( 'only-key' === $value ) {
91
+ $atts .= ' ' . esc_attr( $key );
92
  } else {
93
+ $atts .= ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
94
  }
95
  }
96
  }
99
 
100
  }
101
 
102
+ /**
103
+ * Field before.
104
+ *
105
+ * @return mixed
106
+ */
107
  public function field_before() {
108
  return ( ! empty( $this->field['before'] ) ) ? $this->field['before'] : '';
109
  }
110
 
111
+ /**
112
+ * Field after.
113
+ *
114
+ * @return mixed
115
+ */
116
  public function field_after() {
117
 
118
  $output = ( ! empty( $this->field['after'] ) ) ? $this->field['after'] : '';
124
 
125
  }
126
 
127
+ /**
128
+ * Field Data.
129
+ *
130
+ * @param array $type post types.
131
+ * @param boolean $term post term.
132
+ * @param array $query_args post term.
133
+ *
134
+ * @return statement
135
+ */
136
  public static function field_data( $type = '', $term = false, $query_args = array() ) {
137
 
138
  $options = array();
139
  $array_search = false;
140
 
141
  // sanitize type name.
142
+ if ( in_array( $type, array( 'page', 'pages' ), true ) ) {
143
  $option = 'page';
144
+ } elseif ( in_array( $type, array( 'post', 'posts' ), true ) ) {
145
  $option = 'post';
146
+ } elseif ( in_array( $type, array( 'category', 'categories' ), true ) ) {
147
  $option = 'category';
148
+ } elseif ( in_array( $type, array( 'tag', 'tags' ), true ) ) {
149
  $option = 'post_tag';
150
+ } elseif ( in_array( $type, array( 'menu', 'menus' ), true ) ) {
151
  $option = 'nav_menu';
152
  } else {
153
  $option = '';
374
 
375
  }
376
 
377
+ /**
378
+ * WP Query data title
379
+ *
380
+ * @param string $type The field option type.
381
+ * @param array $values Values of the field.
382
+ * @since 2.1.1
383
+ * @return statement
384
+ */
385
  public function field_wp_query_data_title( $type, $values ) {
386
 
387
  $options = array();
440
 
441
  case 'role':
442
  case 'roles':
443
+ global $wp_roles;
444
 
445
  if ( ! empty( $wp_roles ) && ! empty( $wp_roles->roles ) && ! empty( $wp_roles->roles[ $value ] ) ) {
446
  $options[ $value ] = $wp_roles->roles[ $value ]['name'];
450
 
451
  case 'post_type':
452
  case 'post_types':
453
+ $post_types = get_post_types( array( 'show_in_nav_menus' => true ) );
454
 
455
  if ( ! is_wp_error( $post_types ) && ! empty( $post_types ) && ! empty( $post_types[ $value ] ) ) {
456
  $options[ $value ] = ucfirst( $value );
admin/views/framework/classes/metabox.class.php CHANGED
@@ -1,22 +1,63 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Metabox Class
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Metabox extends SPFTESTIMONIAL_Abstract {
12
 
13
- // constans
14
- public $unique = '';
15
- public $abstract = 'metabox';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  public $pre_fields = array();
17
- public $sections = array();
18
- public $post_type = array();
19
- public $args = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  'title' => '',
21
  'post_type' => 'post',
22
  'data_type' => 'serialize',
@@ -34,7 +75,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
34
  'defaults' => array(),
35
  );
36
 
37
- // run metabox construct
 
 
 
 
 
38
  public function __construct( $key, $params = array() ) {
39
 
40
  $this->unique = $key;
@@ -55,16 +101,28 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
55
  }
56
  }
57
 
58
- // wp enqeueu for typography and output css
59
  parent::__construct();
60
 
61
  }
62
 
63
- // instance
 
 
 
 
 
 
64
  public static function instance( $key, $params = array() ) {
65
  return new self( $key, $params );
66
  }
67
 
 
 
 
 
 
 
68
  public function pre_fields( $sections ) {
69
 
70
  $result = array();
@@ -80,6 +138,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
80
  return $result;
81
  }
82
 
 
 
 
 
 
83
  public function add_metabox_classes( $classes ) {
84
 
85
  global $post;
@@ -91,8 +154,9 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
91
 
92
  $classes[] = 'spftestimonial-post-formats';
93
 
94
- // Sanitize post format for standard to default
95
- if ( ( $key = array_search( 'standard', $this->post_formats ) ) !== false ) {
 
96
  $this->post_formats[ $key ] = 'default';
97
  }
98
 
@@ -100,7 +164,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
100
  $classes[] = 'spftestimonial-post-format-' . $format;
101
  }
102
 
103
- if ( ! in_array( $saved_post_format, $this->post_formats ) ) {
104
  $classes[] = 'spftestimonial-hide';
105
  } else {
106
  $classes[] = 'spftestimonial-show';
@@ -117,7 +181,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
117
  $classes[] = 'spftestimonial-page-' . preg_replace( '/[^a-zA-Z0-9]+/', '-', strtolower( $template ) );
118
  }
119
 
120
- if ( ! in_array( $saved_template, $this->page_templates ) ) {
121
  $classes[] = 'spftestimonial-hide';
122
  } else {
123
  $classes[] = 'spftestimonial-show';
@@ -132,16 +196,25 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
132
 
133
  }
134
 
135
- // add metabox
 
 
 
 
136
  public function add_meta_box( $post_type ) {
137
 
138
- if ( ! in_array( $post_type, $this->args['exclude_post_types'] ) ) {
139
  add_meta_box( $this->unique, $this->args['title'], array( &$this, 'add_meta_box_content' ), $this->post_type, $this->args['context'], $this->args['priority'], $this->args );
140
  }
141
 
142
  }
143
 
144
- // get default value
 
 
 
 
 
145
  public function get_default( $field ) {
146
 
147
  $default = ( isset( $field['id'] ) && isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : null;
@@ -151,7 +224,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
151
 
152
  }
153
 
154
- // get meta value
 
 
 
 
 
155
  public function get_meta_value( $field ) {
156
 
157
  global $post;
@@ -160,7 +238,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
160
 
161
  if ( is_object( $post ) && ! empty( $field['id'] ) ) {
162
 
163
- if ( $this->args['data_type'] !== 'serialize' ) {
164
  $meta = get_post_meta( $post->ID, $field['id'] );
165
  $value = ( isset( $meta[0] ) ) ? $meta[0] : null;
166
  } else {
@@ -176,12 +254,18 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
176
 
177
  }
178
 
179
- // add metabox content
 
 
 
 
 
 
180
  public function add_meta_box_content( $post, $callback ) {
181
 
182
  global $post;
183
 
184
- $has_nav = ( count( $this->sections ) > 1 && $this->args['context'] !== 'side' ) ? true : false;
185
  $show_all = ( ! $has_nav ) ? ' spftestimonial-show-all' : '';
186
  $errors = ( is_object( $post ) ) ? get_post_meta( $post->ID, '_spftestimonial_errors', true ) : array();
187
  $errors = ( ! empty( $errors ) ) ? $errors : array();
@@ -193,66 +277,66 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
193
 
194
  wp_nonce_field( 'spftestimonial_metabox_nonce', 'spftestimonial_metabox_nonce' . $this->unique );
195
 
196
- echo '<div class="spftestimonial spftestimonial-metabox' . $theme . '">';
197
 
198
  $current_screen = get_current_screen();
199
  $the_current_post_type = $current_screen->post_type;
200
- if ( $the_current_post_type == 'spt_shortcodes' ) { ?>
201
  <div class="sptpro-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>
202
- <div class="sp-tpro-banner">
203
- <div class="sp-tpro-logo"><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/testimonial-logo.svg'; ?>" alt="Testimonial"></div>
204
  <div class="sp-tpro-short-links">
205
- <a href="https://shapedplugin.com/support/?user=lite" target="_blank"><i class="fa fa-life-ring"></i>Support</a>
 
206
  </div>
207
- </div>
208
  <div class="tpro_shortcode text-center">
209
- <div class="tpro-col-lg-6">
210
  <div class="tpro_shortcode_content">
211
  <h2 class="tpro-shortcode-title">
212
  <?php
213
- _e( 'Shortcode', 'testimonial-free' );
214
  ?>
215
  </h2>
216
- <p><?php _e( 'Copy and paste this shortcode into your posts or pages:', 'testimonial-free' ); ?></p>
217
  <div class="tpro-sc-code selectable" >[sp_testimonial
218
  <?php
219
- echo 'id="' . $post->ID . '"';
220
  ?>
221
  ]</div>
222
  </div>
223
- </div>
224
- <div class="tpro-col-lg-6">
225
  <div class="tpro_shortcode_content">
226
  <h2 class="tpro-shortcode-title">
227
  <?php
228
- _e( 'Template Include', 'testimonial-free' );
229
  ?>
230
  </h2>
231
- <p><?php _e( 'Paste the PHP code into your template file:', 'testimonial-free' ); ?></p>
232
  <div class="tpro-sc-code selectable">
233
- &lt;?php echo do_shortcode('[sp_testimonial id="<?php echo $post->ID; ?>"]');
234
  ?&gt;</div>
235
  </div>
236
- </div>
237
  </div>
238
- <div class="sp-testimonial-shortcode-divider"></div>
 
239
  <?php
240
  }
241
 
242
- echo '<div class="spftestimonial-wrapper' . $show_all . '">';
243
 
244
  if ( $has_nav ) {
245
 
246
- echo '<div class="spftestimonial-nav spftestimonial-nav-metabox" data-unique="' . $this->unique . '">';
247
 
248
  echo '<ul>';
249
  $tab_key = 1;
250
  foreach ( $this->sections as $section ) {
251
 
252
  $tab_error = ( ! empty( $errors['sections'][ $tab_key ] ) ) ? '<i class="spftestimonial-label-error spftestimonial-error">!</i>' : '';
253
- $tab_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . $section['icon'] . '"></i>' : '';
254
 
255
- echo '<li><a href="#" data-section="' . $this->unique . '_' . $tab_key . '">' . $tab_icon . $section['title'] . $tab_error . '</a></li>';
256
 
257
  $tab_key++;
258
  }
@@ -272,12 +356,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
272
 
273
  $onload = ( ! $has_nav ) ? ' spftestimonial-onload' : '';
274
 
275
- echo '<div id="spftestimonial-section-' . $this->unique . '_' . $section_key . '" class="spftestimonial-section' . $onload . '">';
276
 
277
  $section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . $section['icon'] . '"></i>' : '';
278
  $section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
279
 
280
- echo ( $section_title || $section_icon ) ? '<div class="spftestimonial-section-title"><h3>' . $section_icon . $section_title . '</h3></div>' : '';
281
 
282
  if ( ! empty( $section['fields'] ) ) {
283
 
@@ -309,7 +393,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
309
 
310
  echo '<div class="spftestimonial-restore-wrapper">';
311
  echo '<label>';
312
- echo '<input type="checkbox" name="' . $this->unique . '[_restore]" />';
313
  echo '<span class="button spftestimonial-button-restore">' . esc_html__( 'Restore', 'testimonial-free' ) . '</span>';
314
  echo '<span class="button spftestimonial-button-cancel">' . sprintf( '<small>( %s )</small> %s', esc_html__( 'update post for restore ', 'testimonial-free' ), esc_html__( 'Cancel', 'testimonial-free' ) ) . '</span>';
315
  echo '</label>';
@@ -329,7 +413,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
329
 
330
  }
331
 
332
- // save metabox
 
 
 
 
 
333
  public function save_meta_box( $post_id ) {
334
 
335
  if ( ! wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_metabox_nonce' . $this->unique ), 'spftestimonial_metabox_nonce' ) ) {
@@ -345,12 +434,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
345
 
346
  if ( ! empty( $request ) ) {
347
 
348
- // ignore _nonce
349
  if ( isset( $request['_nonce'] ) ) {
350
  unset( $request['_nonce'] );
351
  }
352
 
353
- // sanitize and validate
354
  $section_key = 1;
355
  foreach ( $this->sections as $section ) {
356
 
@@ -360,7 +449,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
360
 
361
  if ( ! empty( $field['id'] ) ) {
362
 
363
- // sanitize
364
  if ( ! empty( $field['sanitize'] ) ) {
365
 
366
  $sanitize = $field['sanitize'];
@@ -369,7 +458,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
369
 
370
  }
371
 
372
- // validate
373
  if ( ! empty( $field['validate'] ) ) {
374
 
375
  $validate = $field['validate'];
@@ -385,7 +474,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
385
  }
386
  }
387
 
388
- // auto sanitize
389
  if ( ! isset( $request[ $field['id'] ] ) || is_null( $request[ $field['id'] ] ) ) {
390
  $request[ $field['id'] ] = '';
391
  }
@@ -403,7 +492,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
403
 
404
  if ( empty( $request ) || ! empty( $request['_restore'] ) ) {
405
 
406
- if ( $this->args['data_type'] !== 'serialize' ) {
407
  foreach ( $request as $key => $value ) {
408
  delete_post_meta( $post_id, $key );
409
  }
@@ -412,7 +501,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
412
  }
413
  } else {
414
 
415
- if ( $this->args['data_type'] !== 'serialize' ) {
416
  foreach ( $request as $key => $value ) {
417
  update_post_meta( $post_id, $key, $value );
418
  }
1
+ <?php
 
2
  /**
3
+ * Framework metabox.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Metabox' ) ) {
16
+ /**
17
+ *
18
+ * Metabox Class
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Metabox extends SPFTESTIMONIAL_Abstract {
24
 
25
+ /**
26
+ * Property.
27
+ *
28
+ * @var string
29
+ */
30
+ public $unique = '';
31
+ /**
32
+ * Properties for metabox.
33
+ *
34
+ * @var string
35
+ */
36
+ public $abstract = 'metabox';
37
+ /**
38
+ * Pre fields property.
39
+ *
40
+ * @var array
41
+ */
42
  public $pre_fields = array();
43
+ /**
44
+ * Sections.
45
+ *
46
+ * @var array
47
+ */
48
+ public $sections = array();
49
+ /**
50
+ * Post Types.
51
+ *
52
+ * @var array
53
+ */
54
+ public $post_type = array();
55
+ /**
56
+ * Arguments.
57
+ *
58
+ * @var array
59
+ */
60
+ public $args = array(
61
  'title' => '',
62
  'post_type' => 'post',
63
  'data_type' => 'serialize',
75
  'defaults' => array(),
76
  );
77
 
78
+ /**
79
+ * Run metabox construct.
80
+ *
81
+ * @param mixed $key The metabox key.
82
+ * @param array $params The metabox parameters.
83
+ */
84
  public function __construct( $key, $params = array() ) {
85
 
86
  $this->unique = $key;
101
  }
102
  }
103
 
104
+ // wp enqeueu for typography and output css.
105
  parent::__construct();
106
 
107
  }
108
 
109
+ /**
110
+ * Instance.
111
+ *
112
+ * @param string $key Key of the metabox.
113
+ * @param array $params Array of parameters.
114
+ * @return statement
115
+ */
116
  public static function instance( $key, $params = array() ) {
117
  return new self( $key, $params );
118
  }
119
 
120
+ /**
121
+ * Pre fields
122
+ *
123
+ * @param array $sections The sections.
124
+ * @return statement
125
+ */
126
  public function pre_fields( $sections ) {
127
 
128
  $result = array();
138
  return $result;
139
  }
140
 
141
+ /**
142
+ * Add metabox classes.
143
+ *
144
+ * @param array $classes The metabox classes.
145
+ */
146
  public function add_metabox_classes( $classes ) {
147
 
148
  global $post;
154
 
155
  $classes[] = 'spftestimonial-post-formats';
156
 
157
+ // Sanitize post format for standard to default.
158
+ $key = array_search( 'standard', $this->post_formats, true );
159
+ if ( ( $key ) !== false ) {
160
  $this->post_formats[ $key ] = 'default';
161
  }
162
 
164
  $classes[] = 'spftestimonial-post-format-' . $format;
165
  }
166
 
167
+ if ( ! in_array( $saved_post_format, $this->post_formats, true ) ) {
168
  $classes[] = 'spftestimonial-hide';
169
  } else {
170
  $classes[] = 'spftestimonial-show';
181
  $classes[] = 'spftestimonial-page-' . preg_replace( '/[^a-zA-Z0-9]+/', '-', strtolower( $template ) );
182
  }
183
 
184
+ if ( ! in_array( $saved_template, $this->page_templates, true ) ) {
185
  $classes[] = 'spftestimonial-hide';
186
  } else {
187
  $classes[] = 'spftestimonial-show';
196
 
197
  }
198
 
199
+ /**
200
+ * Add metabox
201
+ *
202
+ * @param array $post_type The post types.
203
+ */
204
  public function add_meta_box( $post_type ) {
205
 
206
+ if ( ! in_array( $post_type, $this->args['exclude_post_types'], true ) ) {
207
  add_meta_box( $this->unique, $this->args['title'], array( &$this, 'add_meta_box_content' ), $this->post_type, $this->args['context'], $this->args['priority'], $this->args );
208
  }
209
 
210
  }
211
 
212
+ /**
213
+ * Get default value.
214
+ *
215
+ * @param array $field The field value.
216
+ * @return mixed
217
+ */
218
  public function get_default( $field ) {
219
 
220
  $default = ( isset( $field['id'] ) && isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : null;
224
 
225
  }
226
 
227
+ /**
228
+ * Get meta value.
229
+ *
230
+ * @param object $field The field.
231
+ * @return statement
232
+ */
233
  public function get_meta_value( $field ) {
234
 
235
  global $post;
238
 
239
  if ( is_object( $post ) && ! empty( $field['id'] ) ) {
240
 
241
+ if ( 'serialize' !== $this->args['data_type'] ) {
242
  $meta = get_post_meta( $post->ID, $field['id'] );
243
  $value = ( isset( $meta[0] ) ) ? $meta[0] : null;
244
  } else {
254
 
255
  }
256
 
257
+ /**
258
+ * Add metabox content
259
+ *
260
+ * @param object $post The post.
261
+ * @param array $callback The callback function.
262
+ * @return void
263
+ */
264
  public function add_meta_box_content( $post, $callback ) {
265
 
266
  global $post;
267
 
268
+ $has_nav = ( count( $this->sections ) > 1 && 'side' !== $this->args['context'] ) ? true : false;
269
  $show_all = ( ! $has_nav ) ? ' spftestimonial-show-all' : '';
270
  $errors = ( is_object( $post ) ) ? get_post_meta( $post->ID, '_spftestimonial_errors', true ) : array();
271
  $errors = ( ! empty( $errors ) ) ? $errors : array();
277
 
278
  wp_nonce_field( 'spftestimonial_metabox_nonce', 'spftestimonial_metabox_nonce' . $this->unique );
279
 
280
+ echo '<div class="spftestimonial spftestimonial-metabox' . esc_attr( $theme ) . '">';
281
 
282
  $current_screen = get_current_screen();
283
  $the_current_post_type = $current_screen->post_type;
284
+ if ( 'spt_shortcodes' === $the_current_post_type ) { ?>
285
  <div class="sptpro-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>
286
+ <div class="sp-tpro-banner">
287
+ <div class="sp-tpro-logo"><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/testimonial-logo.svg' ); ?>" alt="Testimonial"></div>
288
  <div class="sp-tpro-short-links">
289
+ <a href="https://shapedplugin.com/support/?user=lite" target="_blank"><i class="fa fa-life-ring"></i>Support</a>
290
+ </div>
291
  </div>
 
292
  <div class="tpro_shortcode text-center">
293
+ <div class="tpro-col-lg-6">
294
  <div class="tpro_shortcode_content">
295
  <h2 class="tpro-shortcode-title">
296
  <?php
297
+ esc_html_e( 'Shortcode', 'testimonial-free' );
298
  ?>
299
  </h2>
300
+ <p><?php esc_html_e( 'Copy and paste this shortcode into your posts or pages:', 'testimonial-free' ); ?></p>
301
  <div class="tpro-sc-code selectable" >[sp_testimonial
302
  <?php
303
+ echo 'id="' . esc_attr( $post->ID ) . '"';
304
  ?>
305
  ]</div>
306
  </div>
307
+ </div>
308
+ <div class="tpro-col-lg-6">
309
  <div class="tpro_shortcode_content">
310
  <h2 class="tpro-shortcode-title">
311
  <?php
312
+ esc_html_e( 'Template Include', 'testimonial-free' );
313
  ?>
314
  </h2>
315
+ <p><?php esc_html_e( 'Paste the PHP code into your template file:', 'testimonial-free' ); ?></p>
316
  <div class="tpro-sc-code selectable">
317
+ &lt;?php echo do_shortcode('[sp_testimonial id="<?php echo esc_attr( $post->ID ); ?>"]');
318
  ?&gt;</div>
319
  </div>
 
320
  </div>
321
+ </div>
322
+ <div class="sp-testimonial-shortcode-divider"></div>
323
  <?php
324
  }
325
 
326
+ echo '<div class="spftestimonial-wrapper' . esc_attr( $show_all ) . '">';
327
 
328
  if ( $has_nav ) {
329
 
330
+ echo '<div class="spftestimonial-nav spftestimonial-nav-metabox" data-unique="' . esc_attr( $this->unique ) . '">';
331
 
332
  echo '<ul>';
333
  $tab_key = 1;
334
  foreach ( $this->sections as $section ) {
335
 
336
  $tab_error = ( ! empty( $errors['sections'][ $tab_key ] ) ) ? '<i class="spftestimonial-label-error spftestimonial-error">!</i>' : '';
337
+ $tab_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . esc_attr( $section['icon'] ) . '"></i>' : '';
338
 
339
+ echo '<li><a href="#" data-section="' . esc_attr( $this->unique . '_' . $tab_key ) . '">' . wp_kses_post( $tab_icon . $section['title'] . $tab_error ) . '</a></li>';
340
 
341
  $tab_key++;
342
  }
356
 
357
  $onload = ( ! $has_nav ) ? ' spftestimonial-onload' : '';
358
 
359
+ echo '<div id="spftestimonial-section-' . esc_attr( $this->unique . '_' . $section_key ) . '" class="spftestimonial-section' . esc_attr( $onload ) . '">';
360
 
361
  $section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . $section['icon'] . '"></i>' : '';
362
  $section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
363
 
364
+ echo ( $section_title || $section_icon ) ? '<div class="spftestimonial-section-title"><h3>' . wp_kses_post( $section_icon . $section_title ) . '</h3></div>' : '';
365
 
366
  if ( ! empty( $section['fields'] ) ) {
367
 
393
 
394
  echo '<div class="spftestimonial-restore-wrapper">';
395
  echo '<label>';
396
+ echo '<input type="checkbox" name="' . esc_attr( $this->unique ) . '[_restore]" />';
397
  echo '<span class="button spftestimonial-button-restore">' . esc_html__( 'Restore', 'testimonial-free' ) . '</span>';
398
  echo '<span class="button spftestimonial-button-cancel">' . sprintf( '<small>( %s )</small> %s', esc_html__( 'update post for restore ', 'testimonial-free' ), esc_html__( 'Cancel', 'testimonial-free' ) ) . '</span>';
399
  echo '</label>';
413
 
414
  }
415
 
416
+ /**
417
+ * Save metabox.
418
+ *
419
+ * @param array $post_id The post IDs.
420
+ * @return statement
421
+ */
422
  public function save_meta_box( $post_id ) {
423
 
424
  if ( ! wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_metabox_nonce' . $this->unique ), 'spftestimonial_metabox_nonce' ) ) {
434
 
435
  if ( ! empty( $request ) ) {
436
 
437
+ // ignore _nonce.
438
  if ( isset( $request['_nonce'] ) ) {
439
  unset( $request['_nonce'] );
440
  }
441
 
442
+ // sanitize and validate.
443
  $section_key = 1;
444
  foreach ( $this->sections as $section ) {
445
 
449
 
450
  if ( ! empty( $field['id'] ) ) {
451
 
452
+ // sanitize.
453
  if ( ! empty( $field['sanitize'] ) ) {
454
 
455
  $sanitize = $field['sanitize'];
458
 
459
  }
460
 
461
+ // validate.
462
  if ( ! empty( $field['validate'] ) ) {
463
 
464
  $validate = $field['validate'];
474
  }
475
  }
476
 
477
+ // auto sanitize.
478
  if ( ! isset( $request[ $field['id'] ] ) || is_null( $request[ $field['id'] ] ) ) {
479
  $request[ $field['id'] ] = '';
480
  }
492
 
493
  if ( empty( $request ) || ! empty( $request['_restore'] ) ) {
494
 
495
+ if ( 'serialize' !== $this->args['data_type'] ) {
496
  foreach ( $request as $key => $value ) {
497
  delete_post_meta( $post_id, $key );
498
  }
501
  }
502
  } else {
503
 
504
+ if ( 'serialize' !== $this->args['data_type'] ) {
505
  foreach ( $request as $key => $value ) {
506
  update_post_meta( $post_id, $key, $value );
507
  }
admin/views/framework/classes/options.class.php CHANGED
@@ -1,32 +1,93 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Options Class
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Options extends SPFTESTIMONIAL_Abstract {
12
 
13
- // constans
14
- public $unique = '';
15
- public $notice = '';
16
- public $abstract = 'options';
17
- public $sections = array();
18
- public $options = array();
19
- public $errors = array();
20
- public $pre_tabs = array();
21
- public $pre_fields = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  public $pre_sections = array();
23
- public $args = array(
24
-
25
- // framework title
 
 
 
 
 
26
  'framework_title' => '',
27
  'framework_class' => '',
28
 
29
- // menu settings
30
  'menu_title' => '',
31
  'menu_slug' => '',
32
  'menu_type' => 'menu',
@@ -36,7 +97,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
36
  'menu_hidden' => false,
37
  'menu_parent' => '',
38
 
39
- // menu extras
40
  'show_bar_menu' => true,
41
  'show_sub_menu' => true,
42
  'show_network_menu' => true,
@@ -52,47 +113,53 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
52
  'save_defaults' => true,
53
  'ajax_save' => true,
54
 
55
- // admin bar menu settings
56
  'admin_bar_menu_icon' => '',
57
  'admin_bar_menu_priority' => 80,
58
 
59
- // footer
60
  'footer_text' => '',
61
  'footer_after' => '',
62
  'footer_credit' => '',
63
 
64
- // database model
65
- 'database' => '', // options, transient, theme_mod, network
66
  'transient_time' => 0,
67
 
68
- // contextual help
69
  'contextual_help' => array(),
70
  'contextual_help_sidebar' => '',
71
 
72
- // typography options
73
  'enqueue_webfont' => true,
74
  'async_webfont' => false,
75
 
76
- // others
77
  'output_css' => true,
78
 
79
- // theme
80
  'theme' => 'dark',
81
  'class' => '',
82
 
83
- // external default values
84
  'defaults' => array(),
85
 
86
  );
87
 
88
- // run framework construct
 
 
 
 
 
 
89
  public function __construct( $key, $params = array() ) {
90
 
91
  $this->unique = $key;
92
  $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
93
  $this->sections = apply_filters( "spftestimonial_{$this->unique}_sections", $params['sections'], $this );
94
 
95
- // run only is admin panel options, avoid performance loss
96
  $this->pre_tabs = $this->pre_tabs( $this->sections );
97
  $this->pre_fields = $this->pre_fields( $this->sections );
98
  $this->pre_sections = $this->pre_sections( $this->sections );
@@ -109,16 +176,28 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
109
  add_action( 'network_admin_menu', array( &$this, 'add_admin_menu' ) );
110
  }
111
 
112
- // wp enqeueu for typography and output css
113
  parent::__construct();
114
 
115
  }
116
 
117
- // instance
 
 
 
 
 
 
118
  public static function instance( $key, $params = array() ) {
119
  return new self( $key, $params );
120
  }
121
 
 
 
 
 
 
 
122
  public function pre_tabs( $sections ) {
123
 
124
  $result = array();
@@ -146,6 +225,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
146
  return wp_list_sort( $result, array( 'priority' => 'ASC' ), 'ASC', true );
147
  }
148
 
 
 
 
 
 
 
149
  public function pre_fields( $sections ) {
150
 
151
  $result = array();
@@ -161,6 +246,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
161
  return $result;
162
  }
163
 
 
 
 
 
 
 
164
  public function pre_sections( $sections ) {
165
 
166
  $result = array();
@@ -179,7 +270,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
179
  return $result;
180
  }
181
 
182
- // add admin bar menu
 
 
 
 
 
183
  public function add_admin_bar_menu( $wp_admin_bar ) {
184
 
185
  if ( ! empty( $this->args['show_bar_menu'] ) && empty( $this->args['menu_hidden'] ) ) {
@@ -224,12 +320,16 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
224
 
225
  }
226
 
 
 
 
 
 
227
  public function ajax_save() {
228
 
229
  if ( ! empty( $_POST['data'] ) ) {
230
 
231
- // $_POST = json_decode( stripslashes( $_POST['data'] ), true );
232
- $_POST = json_decode( wp_unslash( wp_kses_post_deep( $_POST['data'] ) ), true );
233
 
234
  if ( wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_options_nonce' . $this->unique ), 'spftestimonial_options_nonce' ) ) {
235
 
@@ -255,7 +355,13 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
255
 
256
  }
257
 
258
- // get default value
 
 
 
 
 
 
259
  public function get_default( $field, $options = array() ) {
260
 
261
  $default = ( isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : '';
@@ -266,7 +372,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
266
 
267
  }
268
 
269
- // save defaults and set new fields value to main options
 
 
 
 
270
  public function save_defaults() {
271
 
272
  $tmp_options = $this->options;
@@ -283,7 +393,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
283
 
284
  }
285
 
286
- // set options
 
 
 
 
287
  public function set_options() {
288
 
289
  if ( wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_options_nonce' . $this->unique ), 'spftestimonial_options_nonce' ) ) {
@@ -292,7 +406,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
292
  $transient = spftestimonial_get_var( 'spftestimonial_transient' );
293
  $section_id = ( ! empty( $transient['section'] ) ) ? $transient['section'] : '';
294
 
295
- // import data
296
  if ( ! empty( $transient['spftestimonial_import_data'] ) ) {
297
 
298
  $import_data = json_decode( stripslashes( trim( $transient['spftestimonial_import_data'] ) ), true );
@@ -325,12 +439,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
325
 
326
  } else {
327
 
328
- // sanitize and validate
329
  foreach ( $this->pre_fields as $field ) {
330
 
331
  if ( ! empty( $field['id'] ) ) {
332
 
333
- // sanitize
334
  if ( ! empty( $field['sanitize'] ) ) {
335
 
336
  $sanitize = $field['sanitize'];
@@ -339,7 +453,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
339
 
340
  }
341
 
342
- // validate
343
  if ( ! empty( $field['validate'] ) ) {
344
 
345
  $value_validate = isset( $request[ $field['id'] ] ) ? $request[ $field['id'] ] : '';
@@ -351,7 +465,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
351
  }
352
  }
353
 
354
- // auto sanitize
355
  if ( ! isset( $request[ $field['id'] ] ) || is_null( $request[ $field['id'] ] ) ) {
356
  $request[ $field['id'] ] = '';
357
  }
@@ -359,7 +473,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
359
  }
360
  }
361
 
362
- // ignore nonce requests
363
  if ( isset( $request['_nonce'] ) ) {
364
  unset( $request['_nonce'] ); }
365
 
@@ -384,14 +498,19 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
384
 
385
  }
386
 
387
- // save options database
 
 
 
 
 
388
  public function save_options( $request ) {
389
 
390
- if ( $this->args['database'] === 'transient' ) {
391
  set_transient( $this->unique, $request, $this->args['transient_time'] );
392
- } elseif ( $this->args['database'] === 'theme_mod' ) {
393
  set_theme_mod( $this->unique, $request );
394
- } elseif ( $this->args['database'] === 'network' ) {
395
  update_site_option( $this->unique, $request );
396
  } else {
397
  update_option( $this->unique, $request );
@@ -401,14 +520,18 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
401
 
402
  }
403
 
404
- // get options from database
 
 
 
 
405
  public function get_options() {
406
 
407
- if ( $this->args['database'] === 'transient' ) {
408
  $this->options = get_transient( $this->unique );
409
- } elseif ( $this->args['database'] === 'theme_mod' ) {
410
  $this->options = get_theme_mod( $this->unique );
411
- } elseif ( $this->args['database'] === 'network' ) {
412
  $this->options = get_site_option( $this->unique );
413
  } else {
414
  $this->options = get_option( $this->unique );
@@ -422,12 +545,16 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
422
 
423
  }
424
 
425
- // wp api: admin menu
 
 
 
 
426
  public function add_admin_menu() {
427
 
428
- extract( $this->args );
429
 
430
- if ( $menu_type === 'submenu' ) {
431
 
432
  $menu_page = call_user_func( 'add_submenu_page', $menu_parent, $menu_title, $menu_title, $menu_capability, $menu_slug, array( &$this, 'add_options_html' ) );
433
 
@@ -437,7 +564,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
437
 
438
  if ( ! empty( $this->args['show_sub_menu'] ) && count( $this->pre_tabs ) > 1 ) {
439
 
440
- // create submenus
441
  $tab_key = 1;
442
  foreach ( $this->pre_tabs as $section ) {
443
 
@@ -464,6 +591,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
464
 
465
  }
466
 
 
 
 
 
 
467
  public function add_page_on_load() {
468
 
469
  if ( ! empty( $this->args['contextual_help'] ) ) {
@@ -481,6 +613,13 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
481
 
482
  }
483
 
 
 
 
 
 
 
 
484
  public function error_check( $sections, $err = '' ) {
485
 
486
  if ( ! $this->args['ajax_save'] ) {
@@ -509,7 +648,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
509
  return $err;
510
  }
511
 
512
- // option page html output
 
 
 
 
513
  public function add_options_html() {
514
 
515
  $has_nav = ( count( $this->pre_tabs ) > 1 ) ? true : false;
@@ -525,11 +668,9 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
525
  $notice_class = ( ! empty( $this->notice ) ) ? ' spftestimonial-form-show' : '';
526
  $notice_text = ( ! empty( $this->notice ) ) ? $this->notice : '';
527
 
528
- echo '<div class="spftestimonial-form-result spftestimonial-form-success' . $notice_class . '">' . $notice_text . '</div>';
529
-
530
- // echo ( $this->args['show_form_warning'] ) ? '<div class="spftestimonial-form-result spftestimonial-form-warning">' . esc_html__( 'Settings have changed, you should save them!', 'testimonial-free' ) . '</div>' : '';
531
 
532
- echo '<div class="spftestimonial spftestimonial-options' . $theme . $class . $wrapper_class . '" data-slug="' . $this->args['menu_slug'] . '" data-unique="' . $this->unique . '">';
533
 
534
  echo '<div class="spftestimonial-container">';
535
 
@@ -544,9 +685,9 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
544
 
545
  echo '<div class="spftestimonial-header-left">';
546
  if ( $show_buttons ) {
547
- echo '<h1> <img src="' . SP_TFREE_URL . '/admin/assets/images/icon.svg" alt="">' . $this->args['framework_title'] . '</h1>';
548
  } else {
549
- echo '<h1 class="export-import"><img src="' . SP_TFREE_URL . 'admin/assets/images/import-export.svg">' . $this->args['framework_title'] . '</h1>';
550
  }
551
 
552
  echo '</div>';
@@ -558,7 +699,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
558
  echo ( $this->args['show_search'] ) ? '<div class="spftestimonial-search"><input type="text" name="spftestimonial-search" placeholder="' . esc_html__( 'Search option(s)', 'testimonial-free' ) . '" autocomplete="off" /></div>' : '';
559
  if ( $show_buttons ) {
560
  echo '<div class="spftestimonial-buttons">';
561
- echo '<input type="submit" name="' . $this->unique . '[_nonce][save]" class="button button-primary spftestimonial-top-save spftestimonial-save' . $ajax_class . '" value="' . esc_html__( 'Save', 'testimonial-free' ) . '" data-save="' . esc_html__( 'Saving...', 'testimonial-free' ) . '">';
562
  echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="spftestimonial_transient[reset_section]" class="button button-secondary spftestimonial-reset-section spftestimonial-confirm" value="' . esc_html__( 'Reset Section', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset this section options?', 'testimonial-free' ) . '">' : '';
563
  echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="spftestimonial_transient[reset]" class="button spftestimonial-warning-primary spftestimonial-reset-all spftestimonial-confirm" value="' . esc_html__( 'Reset All', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset all options?', 'testimonial-free' ) . '">' : '';
564
  echo '</div>';
@@ -569,7 +710,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
569
  echo '</div>';
570
  echo '</div>';
571
 
572
- echo '<div class="spftestimonial-wrapper' . $show_all . '">';
573
 
574
  if ( $has_nav ) {
575
  echo '<div class="spftestimonial-nav spftestimonial-nav-options">';
@@ -587,7 +728,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
587
 
588
  echo '<li class="spftestimonial-tab-depth-0">';
589
 
590
- echo '<a href="#tab=' . $tab_key . '" class="spftestimonial-arrow">' . $tab_icon . $tab['title'] . $tab_error . '</a>';
591
 
592
  echo '<ul>';
593
 
@@ -596,7 +737,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
596
  $sub_error = $this->error_check( $sub );
597
  $sub_icon = ( ! empty( $sub['icon'] ) ) ? '<i class="' . $sub['icon'] . '"></i>' : '';
598
 
599
- echo '<li class="spftestimonial-tab-depth-1"><a id="spftestimonial-tab-link-' . $tab_key . '" href="#tab=' . $tab_key . '">' . $sub_icon . $sub['title'] . $sub_error . '</a></li>';
600
 
601
  $tab_key++;
602
  }
@@ -607,7 +748,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
607
 
608
  } else {
609
 
610
- echo '<li class="spftestimonial-tab-depth-0"><a id="spftestimonial-tab-link-' . $tab_key . '" href="#tab=' . $tab_key . '">' . $tab_icon . $tab['title'] . $tab_error . '</a></li>';
611
 
612
  $tab_key++;
613
  }
@@ -630,9 +771,9 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
630
  $onload = ( ! $has_nav ) ? ' spftestimonial-onload' : '';
631
  $section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . $section['icon'] . '"></i>' : '';
632
 
633
- echo '<div id="spftestimonial-section-' . $section_key . '" class="spftestimonial-section' . $onload . '">';
634
- echo ( $has_nav ) ? '<div class="spftestimonial-section-title"><h3>' . $section_icon . $section['title'] . '</h3></div>' : '';
635
- echo ( ! empty( $section['description'] ) ) ? '<div class="spftestimonial-field spftestimonial-section-description">' . $section['description'] . '</div>' : '';
636
 
637
  if ( ! empty( $section['fields'] ) ) {
638
 
@@ -675,12 +816,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
675
  echo '<div class="spftestimonial-footer">';
676
 
677
  echo '<div class="spftestimonial-buttons">';
678
- echo '<input type="submit" name="spftestimonial_transient[save]" class="button button-primary spftestimonial-save' . $ajax_class . '" value="' . esc_html__( 'Save', 'testimonial-free' ) . '" data-save="' . esc_html__( 'Saving...', 'testimonial-free' ) . '">';
679
  echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="spftestimonial_transient[reset_section]" class="button button-secondary spftestimonial-reset-section spftestimonial-confirm" value="' . esc_html__( 'Reset Section', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset this section options?', 'testimonial-free' ) . '">' : '';
680
  echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="spftestimonial_transient[reset]" class="button spftestimonial-warning-primary spftestimonial-reset-all spftestimonial-confirm" value="' . esc_html__( 'Reset All', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset all options?', 'testimonial-free' ) . '">' : '';
681
  echo '</div>';
682
 
683
- echo ( ! empty( $this->args['footer_text'] ) ) ? '<div class="spftestimonial-copyright">' . $this->args['footer_text'] . '</div>' : '';
684
 
685
  echo '<div class="clear"></div>';
686
  echo '</div>';
@@ -693,7 +834,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
693
 
694
  echo '<div class="clear"></div>';
695
 
696
- echo ( ! empty( $this->args['footer_after'] ) ) ? $this->args['footer_after'] : '';
697
 
698
  echo '</div>';
699
 
1
+ <?php
 
2
  /**
3
+ * Framework options.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Options' ) ) {
16
+ /**
17
+ *
18
+ * Options Class
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Options extends SPFTESTIMONIAL_Abstract {
24
 
25
+ /**
26
+ * Unique
27
+ *
28
+ * @var string
29
+ */
30
+ public $unique = '';
31
+ /**
32
+ * Notice
33
+ *
34
+ * @var string
35
+ */
36
+ public $notice = '';
37
+ /**
38
+ * Abstract
39
+ *
40
+ * @var string
41
+ */
42
+ public $abstract = 'options';
43
+ /**
44
+ * Sections
45
+ *
46
+ * @var array
47
+ */
48
+ public $sections = array();
49
+ /**
50
+ * Options
51
+ *
52
+ * @var array
53
+ */
54
+ public $options = array();
55
+ /**
56
+ * Errors
57
+ *
58
+ * @var array
59
+ */
60
+ public $errors = array();
61
+ /**
62
+ * Pre_tabs
63
+ *
64
+ * @var array
65
+ */
66
+ public $pre_tabs = array();
67
+ /**
68
+ * Pre_fields
69
+ *
70
+ * @var array
71
+ */
72
+ public $pre_fields = array();
73
+ /**
74
+ * Pre_sections
75
+ *
76
+ * @var array
77
+ */
78
  public $pre_sections = array();
79
+ /**
80
+ * Default Arguments.
81
+ *
82
+ * @var array
83
+ */
84
+ public $args = array(
85
+
86
+ // framework title.
87
  'framework_title' => '',
88
  'framework_class' => '',
89
 
90
+ // menu settings.
91
  'menu_title' => '',
92
  'menu_slug' => '',
93
  'menu_type' => 'menu',
97
  'menu_hidden' => false,
98
  'menu_parent' => '',
99
 
100
+ // menu extras.
101
  'show_bar_menu' => true,
102
  'show_sub_menu' => true,
103
  'show_network_menu' => true,
113
  'save_defaults' => true,
114
  'ajax_save' => true,
115
 
116
+ // admin bar menu settings.
117
  'admin_bar_menu_icon' => '',
118
  'admin_bar_menu_priority' => 80,
119
 
120
+ // footer.
121
  'footer_text' => '',
122
  'footer_after' => '',
123
  'footer_credit' => '',
124
 
125
+ // database model.
126
+ 'database' => '', // options, transient, theme_mod, network.
127
  'transient_time' => 0,
128
 
129
+ // contextual help.
130
  'contextual_help' => array(),
131
  'contextual_help_sidebar' => '',
132
 
133
+ // typography options.
134
  'enqueue_webfont' => true,
135
  'async_webfont' => false,
136
 
137
+ // others.
138
  'output_css' => true,
139
 
140
+ // theme.
141
  'theme' => 'dark',
142
  'class' => '',
143
 
144
+ // external default values.
145
  'defaults' => array(),
146
 
147
  );
148
 
149
+ /**
150
+ * Run framework construct.
151
+ *
152
+ * @param mixed $key key.
153
+ * @param mixed $params params.
154
+ * @return void
155
+ */
156
  public function __construct( $key, $params = array() ) {
157
 
158
  $this->unique = $key;
159
  $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
160
  $this->sections = apply_filters( "spftestimonial_{$this->unique}_sections", $params['sections'], $this );
161
 
162
+ // run only is admin panel options, avoid performance loss.
163
  $this->pre_tabs = $this->pre_tabs( $this->sections );
164
  $this->pre_fields = $this->pre_fields( $this->sections );
165
  $this->pre_sections = $this->pre_sections( $this->sections );
176
  add_action( 'network_admin_menu', array( &$this, 'add_admin_menu' ) );
177
  }
178
 
179
+ // wp enqeueu for typography and output css.
180
  parent::__construct();
181
 
182
  }
183
 
184
+ /**
185
+ * Instance
186
+ *
187
+ * @param mixed $key key.
188
+ * @param mixed $params params.
189
+ * @return statement
190
+ */
191
  public static function instance( $key, $params = array() ) {
192
  return new self( $key, $params );
193
  }
194
 
195
+ /**
196
+ * Pre_tabs
197
+ *
198
+ * @param array $sections sections.
199
+ * @return array
200
+ */
201
  public function pre_tabs( $sections ) {
202
 
203
  $result = array();
225
  return wp_list_sort( $result, array( 'priority' => 'ASC' ), 'ASC', true );
226
  }
227
 
228
+ /**
229
+ * Pre_fields
230
+ *
231
+ * @param mixed $sections sections.
232
+ * @return array
233
+ */
234
  public function pre_fields( $sections ) {
235
 
236
  $result = array();
246
  return $result;
247
  }
248
 
249
+ /**
250
+ * Pre_sections
251
+ *
252
+ * @param mixed $sections section.
253
+ * @return array
254
+ */
255
  public function pre_sections( $sections ) {
256
 
257
  $result = array();
270
  return $result;
271
  }
272
 
273
+ /**
274
+ * Add admin bar menu.
275
+ *
276
+ * @param object $wp_admin_bar admin bar.
277
+ * @return void
278
+ */
279
  public function add_admin_bar_menu( $wp_admin_bar ) {
280
 
281
  if ( ! empty( $this->args['show_bar_menu'] ) && empty( $this->args['menu_hidden'] ) ) {
320
 
321
  }
322
 
323
+ /**
324
+ * Ajax_save
325
+ *
326
+ * @return void
327
+ */
328
  public function ajax_save() {
329
 
330
  if ( ! empty( $_POST['data'] ) ) {
331
 
332
+ $_POST = json_decode( wp_unslash( wp_kses_post_deep( $_POST['data'] ) ), true ); // phpcs:ignore
 
333
 
334
  if ( wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_options_nonce' . $this->unique ), 'spftestimonial_options_nonce' ) ) {
335
 
355
 
356
  }
357
 
358
+ /**
359
+ * Get default value
360
+ *
361
+ * @param mixed $field field.
362
+ * @param array $options options.
363
+ * @return mixed
364
+ */
365
  public function get_default( $field, $options = array() ) {
366
 
367
  $default = ( isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : '';
372
 
373
  }
374
 
375
+ /**
376
+ * Save defaults and set new fields value to main options.
377
+ *
378
+ * @return void
379
+ */
380
  public function save_defaults() {
381
 
382
  $tmp_options = $this->options;
393
 
394
  }
395
 
396
+ /**
397
+ * Set options.
398
+ *
399
+ * @return bool
400
+ */
401
  public function set_options() {
402
 
403
  if ( wp_verify_nonce( spftestimonial_get_var( 'spftestimonial_options_nonce' . $this->unique ), 'spftestimonial_options_nonce' ) ) {
406
  $transient = spftestimonial_get_var( 'spftestimonial_transient' );
407
  $section_id = ( ! empty( $transient['section'] ) ) ? $transient['section'] : '';
408
 
409
+ // import data.
410
  if ( ! empty( $transient['spftestimonial_import_data'] ) ) {
411
 
412
  $import_data = json_decode( stripslashes( trim( $transient['spftestimonial_import_data'] ) ), true );
439
 
440
  } else {
441
 
442
+ // sanitize and validate.
443
  foreach ( $this->pre_fields as $field ) {
444
 
445
  if ( ! empty( $field['id'] ) ) {
446
 
447
+ // sanitize.
448
  if ( ! empty( $field['sanitize'] ) ) {
449
 
450
  $sanitize = $field['sanitize'];
453
 
454
  }
455
 
456
+ // validate.
457
  if ( ! empty( $field['validate'] ) ) {
458
 
459
  $value_validate = isset( $request[ $field['id'] ] ) ? $request[ $field['id'] ] : '';
465
  }
466
  }
467
 
468
+ // auto sanitize.
469
  if ( ! isset( $request[ $field['id'] ] ) || is_null( $request[ $field['id'] ] ) ) {
470
  $request[ $field['id'] ] = '';
471
  }
473
  }
474
  }
475
 
476
+ // ignore nonce requests.
477
  if ( isset( $request['_nonce'] ) ) {
478
  unset( $request['_nonce'] ); }
479
 
498
 
499
  }
500
 
501
+ /**
502
+ * Save options database.
503
+ *
504
+ * @param mixed $request Request.
505
+ * @return void
506
+ */
507
  public function save_options( $request ) {
508
 
509
+ if ( 'transient' === $this->args['database'] ) {
510
  set_transient( $this->unique, $request, $this->args['transient_time'] );
511
+ } elseif ( 'theme_mod' === $this->args['database'] ) {
512
  set_theme_mod( $this->unique, $request );
513
+ } elseif ( 'network' === $this->args['database'] ) {
514
  update_site_option( $this->unique, $request );
515
  } else {
516
  update_option( $this->unique, $request );
520
 
521
  }
522
 
523
+ /**
524
+ * Get options from database.
525
+ *
526
+ * @return mixed
527
+ */
528
  public function get_options() {
529
 
530
+ if ( 'transient' === $this->args['database'] ) {
531
  $this->options = get_transient( $this->unique );
532
+ } elseif ( 'theme_mod' === $this->args['database'] ) {
533
  $this->options = get_theme_mod( $this->unique );
534
+ } elseif ( 'network' === $this->args['database'] ) {
535
  $this->options = get_site_option( $this->unique );
536
  } else {
537
  $this->options = get_option( $this->unique );
545
 
546
  }
547
 
548
+ /**
549
+ * Wp api: admin menu.
550
+ *
551
+ * @return void
552
+ */
553
  public function add_admin_menu() {
554
 
555
+ extract( $this->args ); // phpcs:ignore
556
 
557
+ if ( 'submenu' === $menu_type ) {
558
 
559
  $menu_page = call_user_func( 'add_submenu_page', $menu_parent, $menu_title, $menu_title, $menu_capability, $menu_slug, array( &$this, 'add_options_html' ) );
560
 
564
 
565
  if ( ! empty( $this->args['show_sub_menu'] ) && count( $this->pre_tabs ) > 1 ) {
566
 
567
+ // create submenus.
568
  $tab_key = 1;
569
  foreach ( $this->pre_tabs as $section ) {
570
 
591
 
592
  }
593
 
594
+ /**
595
+ * Add_page_on_load
596
+ *
597
+ * @return void
598
+ */
599
  public function add_page_on_load() {
600
 
601
  if ( ! empty( $this->args['contextual_help'] ) ) {
613
 
614
  }
615
 
616
+ /**
617
+ * Error check
618
+ *
619
+ * @param mixed $sections Sections.
620
+ * @param mixed $err error.
621
+ * @return statement
622
+ */
623
  public function error_check( $sections, $err = '' ) {
624
 
625
  if ( ! $this->args['ajax_save'] ) {
648
  return $err;
649
  }
650
 
651
+ /**
652
+ * Option page html output.
653
+ *
654
+ * @return void
655
+ */
656
  public function add_options_html() {
657
 
658
  $has_nav = ( count( $this->pre_tabs ) > 1 ) ? true : false;
668
  $notice_class = ( ! empty( $this->notice ) ) ? ' spftestimonial-form-show' : '';
669
  $notice_text = ( ! empty( $this->notice ) ) ? $this->notice : '';
670
 
671
+ echo '<div class="spftestimonial-form-result spftestimonial-form-success' . esc_attr( $notice_class ) . '">' . wp_kses_post( $notice_text ) . '</div>';
 
 
672
 
673
+ echo '<div class="spftestimonial spftestimonial-options' . esc_attr( $theme . $class . $wrapper_class ) . '" data-slug="' . esc_attr( $this->args['menu_slug'] ) . '" data-unique="' . esc_attr( $this->unique ) . '">';
674
 
675
  echo '<div class="spftestimonial-container">';
676
 
685
 
686
  echo '<div class="spftestimonial-header-left">';
687
  if ( $show_buttons ) {
688
+ echo '<h1> <img src="' . esc_url( SP_TFREE_URL . '/admin/assets/images/icon.svg' ) . '" alt="">' . wp_kses_post( $this->args['framework_title'] ) . '</h1>';
689
  } else {
690
+ echo '<h1 class="export-import"><img src="' . esc_url( SP_TFREE_URL . 'admin/assets/images/import-export.svg' ) . '">' . wp_kses_post( $this->args['framework_title'] ) . '</h1>';
691
  }
692
 
693
  echo '</div>';
699
  echo ( $this->args['show_search'] ) ? '<div class="spftestimonial-search"><input type="text" name="spftestimonial-search" placeholder="' . esc_html__( 'Search option(s)', 'testimonial-free' ) . '" autocomplete="off" /></div>' : '';
700
  if ( $show_buttons ) {
701
  echo '<div class="spftestimonial-buttons">';
702
+ echo '<input type="submit" name="' . esc_attr( $this->unique ) . '[_nonce][save]" class="button button-primary spftestimonial-top-save spftestimonial-save' . esc_attr( $ajax_class ) . '" value="' . esc_html__( 'Save', 'testimonial-free' ) . '" data-save="' . esc_html__( 'Saving...', 'testimonial-free' ) . '">';
703
  echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="spftestimonial_transient[reset_section]" class="button button-secondary spftestimonial-reset-section spftestimonial-confirm" value="' . esc_html__( 'Reset Section', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset this section options?', 'testimonial-free' ) . '">' : '';
704
  echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="spftestimonial_transient[reset]" class="button spftestimonial-warning-primary spftestimonial-reset-all spftestimonial-confirm" value="' . esc_html__( 'Reset All', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset all options?', 'testimonial-free' ) . '">' : '';
705
  echo '</div>';
710
  echo '</div>';
711
  echo '</div>';
712
 
713
+ echo '<div class="spftestimonial-wrapper' . esc_attr( $show_all ) . '">';
714
 
715
  if ( $has_nav ) {
716
  echo '<div class="spftestimonial-nav spftestimonial-nav-options">';
728
 
729
  echo '<li class="spftestimonial-tab-depth-0">';
730
 
731
+ echo '<a href="#tab=' . esc_attr( $tab_key ) . '" class="spftestimonial-arrow">' . wp_kses_post( $tab_icon . $tab['title'] . $tab_error ) . '</a>';
732
 
733
  echo '<ul>';
734
 
737
  $sub_error = $this->error_check( $sub );
738
  $sub_icon = ( ! empty( $sub['icon'] ) ) ? '<i class="' . $sub['icon'] . '"></i>' : '';
739
 
740
+ echo '<li class="spftestimonial-tab-depth-1"><a id="spftestimonial-tab-link-' . esc_attr( $tab_key ) . '" href="#tab=' . esc_attr( $tab_key ) . '">' . wp_kses_post( $sub_icon . $sub['title'] . $sub_error ) . '</a></li>';
741
 
742
  $tab_key++;
743
  }
748
 
749
  } else {
750
 
751
+ echo '<li class="spftestimonial-tab-depth-0"><a id="spftestimonial-tab-link-' . esc_attr( $tab_key ) . '" href="#tab=' . esc_attr( $tab_key ) . '">' . wp_kses_post( $tab_icon . $tab['title'] . $tab_error ) . '</a></li>';
752
 
753
  $tab_key++;
754
  }
771
  $onload = ( ! $has_nav ) ? ' spftestimonial-onload' : '';
772
  $section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="spftestimonial-icon ' . $section['icon'] . '"></i>' : '';
773
 
774
+ echo '<div id="spftestimonial-section-' . esc_attr( $section_key ) . '" class="spftestimonial-section' . esc_attr( $onload ) . '">';
775
+ echo ( $has_nav ) ? '<div class="spftestimonial-section-title"><h3>' . wp_kses_post( $section_icon . $section['title'] ) . '</h3></div>' : '';
776
+ echo ( ! empty( $section['description'] ) ) ? '<div class="spftestimonial-field spftestimonial-section-description">' . wp_kses_post( $section['description'] ) . '</div>' : '';
777
 
778
  if ( ! empty( $section['fields'] ) ) {
779
 
816
  echo '<div class="spftestimonial-footer">';
817
 
818
  echo '<div class="spftestimonial-buttons">';
819
+ echo '<input type="submit" name="spftestimonial_transient[save]" class="button button-primary spftestimonial-save' . esc_attr( $ajax_class ) . '" value="' . esc_html__( 'Save', 'testimonial-free' ) . '" data-save="' . esc_html__( 'Saving...', 'testimonial-free' ) . '">';
820
  echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="spftestimonial_transient[reset_section]" class="button button-secondary spftestimonial-reset-section spftestimonial-confirm" value="' . esc_html__( 'Reset Section', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset this section options?', 'testimonial-free' ) . '">' : '';
821
  echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="spftestimonial_transient[reset]" class="button spftestimonial-warning-primary spftestimonial-reset-all spftestimonial-confirm" value="' . esc_html__( 'Reset All', 'testimonial-free' ) . '" data-confirm="' . esc_html__( 'Are you sure to reset all options?', 'testimonial-free' ) . '">' : '';
822
  echo '</div>';
823
 
824
+ echo ( ! empty( $this->args['footer_text'] ) ) ? '<div class="spftestimonial-copyright">' . wp_kses_post( $this->args['footer_text'] ) . '</div>' : '';
825
 
826
  echo '<div class="clear"></div>';
827
  echo '</div>';
834
 
835
  echo '<div class="clear"></div>';
836
 
837
+ echo ( ! empty( $this->args['footer_after'] ) ) ? wp_kses_post( $this->args['footer_after'] ) : '';
838
 
839
  echo '</div>';
840
 
admin/views/framework/classes/setup.class.php CHANGED
@@ -1,41 +1,90 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Setup Class
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL {
12
 
13
- // constants
 
 
 
 
14
  public static $version = '2.1.3';
15
- public static $dir = null;
16
- public static $url = null;
17
- public static $inited = array();
18
- public static $fields = array();
19
- public static $args = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  'options' => array(),
21
  'customize_options' => array(),
22
  'metaboxes' => array(),
23
  'widgets' => array(),
24
  );
25
 
26
- // shortcode instances
 
 
 
 
27
  public static $shortcode_instances = array();
28
 
29
- // init
 
 
 
 
30
  public static function init() {
31
 
32
- // init action
33
  do_action( 'spftestimonial_init' );
34
 
35
- // set constants
36
  self::constants();
37
 
38
- // include files
39
  self::includes();
40
 
41
  add_action( 'after_setup_theme', array( 'SPFTESTIMONIAL', 'setup' ) );
@@ -47,10 +96,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
47
 
48
  }
49
 
50
- // setup
 
 
 
 
51
  public static function setup() {
52
 
53
- // setup options
54
  $params = array();
55
  if ( ! empty( self::$args['options'] ) ) {
56
  foreach ( self::$args['options'] as $key => $value ) {
@@ -63,16 +116,16 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
63
  SPFTESTIMONIAL_Options::instance( $key, $params );
64
 
65
  if ( ! empty( $value['show_in_customizer'] ) ) {
66
- $value['output_css'] = false;
67
- $value['enqueue_webfont'] = false;
68
- self::$args['customize_options'][ $key ] = $value;
69
- self::$inited[ $key ] = null;
70
  }
71
  }
72
  }
73
  }
74
 
75
- // setup customize options
76
  $params = array();
77
  if ( ! empty( self::$args['customize_options'] ) ) {
78
  foreach ( self::$args['customize_options'] as $key => $value ) {
@@ -88,7 +141,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
88
  }
89
  }
90
 
91
- // setup metaboxes
92
  $params = array();
93
  if ( ! empty( self::$args['metaboxes'] ) ) {
94
  foreach ( self::$args['metaboxes'] as $key => $value ) {
@@ -104,7 +157,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
104
  }
105
  }
106
 
107
- // create widgets
108
  if ( ! empty( self::$args['widgets'] ) && class_exists( 'WP_Widget_Factory' ) ) {
109
 
110
  $wp_widget_factory = new WP_Widget_Factory();
@@ -121,37 +174,71 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
121
 
122
  }
123
 
124
- // create options
 
 
 
 
 
 
125
  public static function createOptions( $id, $args = array() ) {
126
  self::$args['options'][ $id ] = $args;
127
  }
128
 
129
- // create customize options
 
 
 
 
 
 
130
  public static function createCustomizeOptions( $id, $args = array() ) {
131
  self::$args['customize_options'][ $id ] = $args;
132
  }
133
 
134
- // create metabox options
 
 
 
 
 
 
135
  public static function createMetabox( $id, $args = array() ) {
136
  self::$args['metaboxes'][ $id ] = $args;
137
  }
138
 
139
- // create widget
 
 
 
 
 
 
140
  public static function createWidget( $id, $args = array() ) {
141
  self::$args['widgets'][ $id ] = $args;
142
  self::set_used_fields( $args );
143
  }
144
 
145
- // create section
 
 
 
 
 
 
146
  public static function createSection( $id, $sections ) {
147
  self::$args['sections'][ $id ][] = $sections;
148
  self::set_used_fields( $sections );
149
  }
150
 
151
- // constants
 
 
 
 
152
  public static function constants() {
153
 
154
- // we need this path-finder code for set URL of framework
155
  $dirname = wp_normalize_path( dirname( dirname( __FILE__ ) ) );
156
  $theme_dir = wp_normalize_path( get_parent_theme_file_path() );
157
  $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
@@ -167,6 +254,13 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
167
 
168
  }
169
 
 
 
 
 
 
 
 
170
  public static function include_plugin_file( $file, $load = true ) {
171
 
172
  $path = '';
@@ -198,37 +292,57 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
198
  }
199
  } else {
200
 
201
- return self::$dir . '/' . $file;
202
 
203
  }
204
 
205
  }
206
 
 
 
 
 
 
 
207
  public static function is_active_plugin( $file = '' ) {
208
- return in_array( $file, (array) get_option( 'active_plugins', array() ) );
209
  }
210
 
211
- // Sanitize dirname
 
 
 
 
 
212
  public static function sanitize_dirname( $dirname ) {
213
  return preg_replace( '/[^A-Za-z]/', '', $dirname );
214
  }
215
 
216
- // Set plugin url
 
 
 
 
 
217
  public static function include_plugin_url( $file ) {
218
  return self::$url . '/' . ltrim( $file, '/' );
219
  }
220
 
221
- // General includes
 
 
 
 
222
  public static function includes() {
223
 
224
- // includes helpers
225
  self::include_plugin_file( 'functions/actions.php' );
226
  self::include_plugin_file( 'functions/deprecated.php' );
227
  self::include_plugin_file( 'functions/helpers.php' );
228
  self::include_plugin_file( 'functions/sanitize.php' );
229
  self::include_plugin_file( 'functions/validate.php' );
230
 
231
- // includes classes
232
  self::include_plugin_file( 'classes/abstract.class.php' );
233
  self::include_plugin_file( 'classes/fields.class.php' );
234
  self::include_plugin_file( 'classes/options.class.php' );
@@ -238,14 +352,24 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
238
 
239
  }
240
 
241
- // Include field
 
 
 
 
 
242
  public static function maybe_include_field( $type = '' ) {
243
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_' . $type ) && class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
244
  self::include_plugin_file( 'fields/' . $type . '/' . $type . '.php' );
245
  }
246
  }
247
 
248
- // Get all of fields
 
 
 
 
 
249
  public static function set_used_fields( $sections ) {
250
 
251
  if ( ! empty( $sections['fields'] ) ) {
@@ -272,33 +396,36 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
272
 
273
  }
274
 
275
- //
276
- // Enqueue admin and fields styles and scripts.
 
 
 
277
  public static function add_admin_enqueue_scripts() {
278
 
279
  // check for developer mode.
280
  $min = ( apply_filters( 'spftestimonial_dev_mode', false ) || WP_DEBUG ) ? '' : '.min';
281
 
282
- // admin utilities
283
  wp_enqueue_media();
284
 
285
- // wp color picker
286
  wp_enqueue_style( 'wp-color-picker' );
287
  wp_enqueue_script( 'wp-color-picker' );
288
 
289
  $screen = get_current_screen();
290
- if ( $screen->post_type == 'spt_testimonial_form' || $screen->post_type == 'spt_testimonial' || $screen->post_type == 'spt_shortcodes' ) {
291
  wp_enqueue_style( 'tfree-font-awesome', SP_TFREE_URL . 'public/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
292
 
293
- // framework core styles
294
  wp_enqueue_style( 'spftestimonial', self::include_plugin_url( 'assets/css/spftestimonial' . $min . '.css' ), array(), SP_TFREE_VERSION, 'all' );
295
 
296
- // rtl styles
297
  if ( is_rtl() ) {
298
  wp_enqueue_style( 'spftestimonial-rtl', self::include_plugin_url( 'assets/css/spftestimonial-rtl' . $min . '.css' ), array(), SP_TFREE_VERSION, 'all' );
299
  }
300
 
301
- // framework core scripts
302
  wp_enqueue_script( 'spftestimonial-plugins', self::include_plugin_url( 'assets/js/spftestimonial-plugins' . $min . '.js' ), array(), SP_TFREE_VERSION, true );
303
  wp_enqueue_script( 'spftestimonial', self::include_plugin_url( 'assets/js/spftestimonial' . $min . '.js' ), array( 'spftestimonial-plugins' ), SP_TFREE_VERSION, true );
304
 
@@ -308,20 +435,20 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
308
  array(
309
  'color_palette' => apply_filters( 'spftestimonial_color_palette', array() ),
310
  'i18n' => array(
311
- // global localize
312
  'confirm' => esc_html__( 'Are you sure?', 'testimonial-free' ),
313
  'reset_notification' => esc_html__( 'Restoring options.', 'testimonial-free' ),
314
  'import_notification' => esc_html__( 'Importing options.', 'testimonial-free' ),
315
 
316
- // chosen localize
317
- 'typing_text' => esc_html__( 'Please enter %s or more characters', 'testimonial-free' ),
318
  'searching_text' => esc_html__( 'Searching...', 'testimonial-free' ),
319
  'no_results_text' => esc_html__( 'No results match', 'testimonial-free' ),
320
  ),
321
  )
322
  );
323
  }
324
- // load admin enqueue scripts and styles
325
  $enqueued = array();
326
 
327
  if ( ! empty( self::$fields ) ) {
@@ -330,11 +457,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
330
  $classname = 'SPFTESTIMONIAL_Field_' . $field['type'];
331
  self::maybe_include_field( $field['type'] );
332
  if ( class_exists( $classname ) && method_exists( $classname, 'enqueue' ) ) {
333
- $instance = new $classname( $field );
334
  if ( method_exists( $classname, 'enqueue' ) ) {
335
  $instance->enqueue();
336
  }
337
- unset( $instance );
338
  }
339
  }
340
  }
@@ -344,12 +471,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
344
 
345
  }
346
 
347
- //
348
- // WP 5.2 fallback
349
- //
350
- // This function has been created as temporary.
351
- // It will be remove after stable version of wp 5.3.
352
- //
 
 
353
  public static function add_admin_head_css() {
354
 
355
  global $wp_version;
@@ -378,17 +507,25 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
378
 
379
  }
380
 
381
- //
382
- // Add a new framework field
 
 
 
 
 
 
 
 
383
  public static function field( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
384
 
385
- // Check for unallow fields
386
  if ( ! empty( $field['_notice'] ) ) {
387
 
388
  $field_type = $field['type'];
389
 
390
  $field = array();
391
- $field['content'] = sprintf( esc_html__( 'Ooops! This field type (%s) can not be used here, yet.', 'testimonial-free' ), '<strong>' . $field_type . '</strong>' );
392
  $field['type'] = 'notice';
393
  $field['style'] = 'danger';
394
 
@@ -431,11 +568,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
431
 
432
  if ( ! empty( $field_type ) ) {
433
 
434
- echo '<div class="spftestimonial-field spftestimonial-field-' . $field_type . $is_pseudo . $class . $hidden . '"' . $depend . '>';
435
 
436
  if ( ! empty( $field['title'] ) ) {
437
  $subtitle = ( ! empty( $field['subtitle'] ) ) ? '<p class="spftestimonial-text-subtitle">' . $field['subtitle'] . '</p>' : '';
438
- echo '<div class="spftestimonial-title"><h4>' . $field['title'] . '</h4>' . $subtitle . '</div>';
439
  }
440
 
441
  echo ( ! empty( $field['title'] ) ) ? '<div class="spftestimonial-fieldset">' : '';
@@ -454,7 +591,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
454
  echo '<p>' . esc_html__( 'This field class is not available!', 'testimonial-free' ) . '</p>';
455
  }
456
  } else {
457
- echo '<p>' . esc_html__( 'This type is not found!', 'testimonial-free' ) . '</p>';
458
  }
459
 
460
  echo ( ! empty( $field['title'] ) ) ? '</div>' : '';
1
+ <?php
 
2
  /**
3
+ * Framework setup.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL' ) ) {
16
+ /**
17
+ *
18
+ * Setup Class
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL {
24
 
25
+ /**
26
+ * Version.
27
+ *
28
+ * @var string
29
+ */
30
  public static $version = '2.1.3';
31
+ /**
32
+ * Dir.
33
+ *
34
+ * @var string
35
+ */
36
+ public static $dir = null;
37
+ /**
38
+ * Url.
39
+ *
40
+ * @var string
41
+ */
42
+ public static $url = null;
43
+ /**
44
+ * Init.
45
+ *
46
+ * @var array
47
+ */
48
+ public static $inited = array();
49
+ /**
50
+ * Field.
51
+ *
52
+ * @var array
53
+ */
54
+ public static $fields = array();
55
+ /**
56
+ * Args.
57
+ *
58
+ * @var array
59
+ */
60
+ public static $args = array(
61
  'options' => array(),
62
  'customize_options' => array(),
63
  'metaboxes' => array(),
64
  'widgets' => array(),
65
  );
66
 
67
+ /**
68
+ * Shortcode instances.
69
+ *
70
+ * @var array
71
+ */
72
  public static $shortcode_instances = array();
73
 
74
+ /**
75
+ * Init
76
+ *
77
+ * @return void
78
+ */
79
  public static function init() {
80
 
81
+ // init action.
82
  do_action( 'spftestimonial_init' );
83
 
84
+ // set constants.
85
  self::constants();
86
 
87
+ // include files.
88
  self::includes();
89
 
90
  add_action( 'after_setup_theme', array( 'SPFTESTIMONIAL', 'setup' ) );
96
 
97
  }
98
 
99
+ /**
100
+ * Setup
101
+ *
102
+ * @return void
103
+ */
104
  public static function setup() {
105
 
106
+ // setup options.
107
  $params = array();
108
  if ( ! empty( self::$args['options'] ) ) {
109
  foreach ( self::$args['options'] as $key => $value ) {
116
  SPFTESTIMONIAL_Options::instance( $key, $params );
117
 
118
  if ( ! empty( $value['show_in_customizer'] ) ) {
119
+ $value['output_css'] = false;
120
+ $value['enqueue_webfont'] = false;
121
+ self::$args['customize_options'][ $key ] = $value;
122
+ self::$inited[ $key ] = null;
123
  }
124
  }
125
  }
126
  }
127
 
128
+ // setup customize options.
129
  $params = array();
130
  if ( ! empty( self::$args['customize_options'] ) ) {
131
  foreach ( self::$args['customize_options'] as $key => $value ) {
141
  }
142
  }
143
 
144
+ // setup metaboxes.
145
  $params = array();
146
  if ( ! empty( self::$args['metaboxes'] ) ) {
147
  foreach ( self::$args['metaboxes'] as $key => $value ) {
157
  }
158
  }
159
 
160
+ // create widgets.
161
  if ( ! empty( self::$args['widgets'] ) && class_exists( 'WP_Widget_Factory' ) ) {
162
 
163
  $wp_widget_factory = new WP_Widget_Factory();
174
 
175
  }
176
 
177
+ /**
178
+ * Create Options
179
+ *
180
+ * @param mixed $id ID.
181
+ * @param mixed $args Args.
182
+ * @return void
183
+ */
184
  public static function createOptions( $id, $args = array() ) {
185
  self::$args['options'][ $id ] = $args;
186
  }
187
 
188
+ /**
189
+ * Create customize options.
190
+ *
191
+ * @param int $id ID.
192
+ * @param array $args customize option.
193
+ * @return void
194
+ */
195
  public static function createCustomizeOptions( $id, $args = array() ) {
196
  self::$args['customize_options'][ $id ] = $args;
197
  }
198
 
199
+ /**
200
+ * Create metabox options.
201
+ *
202
+ * @param mixed $id ID.
203
+ * @param mixed $args Args.
204
+ * @return void
205
+ */
206
  public static function createMetabox( $id, $args = array() ) {
207
  self::$args['metaboxes'][ $id ] = $args;
208
  }
209
 
210
+ /**
211
+ * Create widget.
212
+ *
213
+ * @param mixed $id ID.
214
+ * @param mixed $args Args.
215
+ * @return void
216
+ */
217
  public static function createWidget( $id, $args = array() ) {
218
  self::$args['widgets'][ $id ] = $args;
219
  self::set_used_fields( $args );
220
  }
221
 
222
+ /**
223
+ * Create section.
224
+ *
225
+ * @param mixed $id ID.
226
+ * @param mixed $sections Sections.
227
+ * @return void
228
+ */
229
  public static function createSection( $id, $sections ) {
230
  self::$args['sections'][ $id ][] = $sections;
231
  self::set_used_fields( $sections );
232
  }
233
 
234
+ /**
235
+ * Constants
236
+ *
237
+ * @return void
238
+ */
239
  public static function constants() {
240
 
241
+ // we need this path-finder code for set URL of framework.
242
  $dirname = wp_normalize_path( dirname( dirname( __FILE__ ) ) );
243
  $theme_dir = wp_normalize_path( get_parent_theme_file_path() );
244
  $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
254
 
255
  }
256
 
257
+ /**
258
+ * Include plugin files
259
+ *
260
+ * @param mixed $file file.
261
+ * @param mixed $load load.
262
+ * @return array
263
+ */
264
  public static function include_plugin_file( $file, $load = true ) {
265
 
266
  $path = '';
292
  }
293
  } else {
294
 
295
+ return self::$dir . '/' . $file;
296
 
297
  }
298
 
299
  }
300
 
301
+ /**
302
+ * Is active plugin
303
+ *
304
+ * @param mixed $file file.
305
+ * @return statement
306
+ */
307
  public static function is_active_plugin( $file = '' ) {
308
+ return in_array( $file, (array) get_option( 'active_plugins', array() ), true );
309
  }
310
 
311
+ /**
312
+ * Sanitize dirname.
313
+ *
314
+ * @param mixed $dirname dirname.
315
+ * @return statement
316
+ */
317
  public static function sanitize_dirname( $dirname ) {
318
  return preg_replace( '/[^A-Za-z]/', '', $dirname );
319
  }
320
 
321
+ /**
322
+ * Set plugin url.
323
+ *
324
+ * @param mixed $file file.
325
+ * @return string
326
+ */
327
  public static function include_plugin_url( $file ) {
328
  return self::$url . '/' . ltrim( $file, '/' );
329
  }
330
 
331
+ /**
332
+ * General includes.
333
+ *
334
+ * @return void
335
+ */
336
  public static function includes() {
337
 
338
+ // includes helpers.
339
  self::include_plugin_file( 'functions/actions.php' );
340
  self::include_plugin_file( 'functions/deprecated.php' );
341
  self::include_plugin_file( 'functions/helpers.php' );
342
  self::include_plugin_file( 'functions/sanitize.php' );
343
  self::include_plugin_file( 'functions/validate.php' );
344
 
345
+ // includes classes.
346
  self::include_plugin_file( 'classes/abstract.class.php' );
347
  self::include_plugin_file( 'classes/fields.class.php' );
348
  self::include_plugin_file( 'classes/options.class.php' );
352
 
353
  }
354
 
355
+ /**
356
+ * Include field.
357
+ *
358
+ * @param mixed $type type.
359
+ * @return void
360
+ */
361
  public static function maybe_include_field( $type = '' ) {
362
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_' . $type ) && class_exists( 'SPFTESTIMONIAL_Fields' ) ) {
363
  self::include_plugin_file( 'fields/' . $type . '/' . $type . '.php' );
364
  }
365
  }
366
 
367
+ /**
368
+ * Get all of fields.
369
+ *
370
+ * @param mixed $sections sections.
371
+ * @return void
372
+ */
373
  public static function set_used_fields( $sections ) {
374
 
375
  if ( ! empty( $sections['fields'] ) ) {
396
 
397
  }
398
 
399
+ /**
400
+ * Enqueue admin and fields styles and scripts.
401
+ *
402
+ * @return void
403
+ */
404
  public static function add_admin_enqueue_scripts() {
405
 
406
  // check for developer mode.
407
  $min = ( apply_filters( 'spftestimonial_dev_mode', false ) || WP_DEBUG ) ? '' : '.min';
408
 
409
+ // admin utilities.
410
  wp_enqueue_media();
411
 
412
+ // wp color picker.
413
  wp_enqueue_style( 'wp-color-picker' );
414
  wp_enqueue_script( 'wp-color-picker' );
415
 
416
  $screen = get_current_screen();
417
+ if ( 'spt_testimonial_form' === $screen->post_type || 'spt_testimonial' === $screen->post_type || 'spt_shortcodes' === $screen->post_type ) {
418
  wp_enqueue_style( 'tfree-font-awesome', SP_TFREE_URL . 'public/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
419
 
420
+ // framework core styles.
421
  wp_enqueue_style( 'spftestimonial', self::include_plugin_url( 'assets/css/spftestimonial' . $min . '.css' ), array(), SP_TFREE_VERSION, 'all' );
422
 
423
+ // rtl styles.
424
  if ( is_rtl() ) {
425
  wp_enqueue_style( 'spftestimonial-rtl', self::include_plugin_url( 'assets/css/spftestimonial-rtl' . $min . '.css' ), array(), SP_TFREE_VERSION, 'all' );
426
  }
427
 
428
+ // framework core scripts.
429
  wp_enqueue_script( 'spftestimonial-plugins', self::include_plugin_url( 'assets/js/spftestimonial-plugins' . $min . '.js' ), array(), SP_TFREE_VERSION, true );
430
  wp_enqueue_script( 'spftestimonial', self::include_plugin_url( 'assets/js/spftestimonial' . $min . '.js' ), array( 'spftestimonial-plugins' ), SP_TFREE_VERSION, true );
431
 
435
  array(
436
  'color_palette' => apply_filters( 'spftestimonial_color_palette', array() ),
437
  'i18n' => array(
438
+ // global localize.
439
  'confirm' => esc_html__( 'Are you sure?', 'testimonial-free' ),
440
  'reset_notification' => esc_html__( 'Restoring options.', 'testimonial-free' ),
441
  'import_notification' => esc_html__( 'Importing options.', 'testimonial-free' ),
442
 
443
+ // chosen localize.
444
+ 'typing_text' => esc_html__( 'Please enter %s or more characters', 'testimonial-free' ), // phpcs:ignore
445
  'searching_text' => esc_html__( 'Searching...', 'testimonial-free' ),
446
  'no_results_text' => esc_html__( 'No results match', 'testimonial-free' ),
447
  ),
448
  )
449
  );
450
  }
451
+ // load admin enqueue scripts and styles.
452
  $enqueued = array();
453
 
454
  if ( ! empty( self::$fields ) ) {
457
  $classname = 'SPFTESTIMONIAL_Field_' . $field['type'];
458
  self::maybe_include_field( $field['type'] );
459
  if ( class_exists( $classname ) && method_exists( $classname, 'enqueue' ) ) {
460
+ $instance = new $classname( $field );
461
  if ( method_exists( $classname, 'enqueue' ) ) {
462
  $instance->enqueue();
463
  }
464
+ unset( $instance );
465
  }
466
  }
467
  }
471
 
472
  }
473
 
474
+ /**
475
+ * WP 5.2 fallback.
476
+ *
477
+ * This function has been created as temporary.
478
+ * It will be remove after stable version of wp 5.3.
479
+ *
480
+ * @return void
481
+ */
482
  public static function add_admin_head_css() {
483
 
484
  global $wp_version;
507
 
508
  }
509
 
510
+ /**
511
+ * Add a new framework field.
512
+ *
513
+ * @param mixed $field Field.
514
+ * @param mixed $value value.
515
+ * @param mixed $unique unique id.
516
+ * @param mixed $where Where.
517
+ * @param mixed $parent parent.
518
+ * @return void
519
+ */
520
  public static function field( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
521
 
522
+ // Check for unallow fields.
523
  if ( ! empty( $field['_notice'] ) ) {
524
 
525
  $field_type = $field['type'];
526
 
527
  $field = array();
528
+ $field['content'] = sprintf( wp_kses_post( 'Ooops! This field type (%s) can not be used here, yet.', 'testimonial-free' ), '<strong>' . $field_type . '</strong>' );
529
  $field['type'] = 'notice';
530
  $field['style'] = 'danger';
531
 
568
 
569
  if ( ! empty( $field_type ) ) {
570
 
571
+ echo '<div class="spftestimonial-field spftestimonial-field-' . esc_attr( $field_type . $is_pseudo . $class . $hidden ) . '"' . wp_kses_post( $depend ) . '>';
572
 
573
  if ( ! empty( $field['title'] ) ) {
574
  $subtitle = ( ! empty( $field['subtitle'] ) ) ? '<p class="spftestimonial-text-subtitle">' . $field['subtitle'] . '</p>' : '';
575
+ echo '<div class="spftestimonial-title"><h4>' . wp_kses_post( $field['title'] ) . '</h4>' . wp_kses_post( $subtitle ) . '</div>';
576
  }
577
 
578
  echo ( ! empty( $field['title'] ) ) ? '<div class="spftestimonial-fieldset">' : '';
591
  echo '<p>' . esc_html__( 'This field class is not available!', 'testimonial-free' ) . '</p>';
592
  }
593
  } else {
594
+ echo '<p>' . esc_html__( 'This type is not found!', 'testimonial-free' ) . '</p>';
595
  }
596
 
597
  echo ( ! empty( $field['title'] ) ) ? '</div>' : '';
admin/views/framework/classes/widgets.class.php CHANGED
@@ -1,129 +1,190 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Widgets Class
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Widget' ) ) {
11
- class SPFTESTIMONIAL_Widget extends WP_Widget {
12
-
13
- // constans
14
- public $unique = '';
15
- public $args = array(
16
- 'title' => '',
17
- 'classname' => '',
18
- 'description' => '',
19
- 'width' => '',
20
- 'defaults' => array(),
21
- 'fields' => array(),
22
- 'class' => '',
23
- );
24
-
25
- public function __construct( $key, $params ) {
26
-
27
- $widget_ops = array();
28
- $control_ops = array();
29
-
30
- $this->unique = $key;
31
- $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this );
32
-
33
- // Set control options
34
- if( ! empty( $this->args['width'] ) ) {
35
- $control_ops['width'] = $this->args['width'];
36
- }
37
-
38
- // Set widget options
39
- if( ! empty( $this->args['description'] ) ) {
40
- $widget_ops['description'] = $this->args['description'];
41
- }
42
-
43
- if( ! empty( $this->args['classname'] ) ) {
44
- $widget_ops['classname'] = $this->args['classname'];
45
- }
46
-
47
- // Set filters
48
- $widget_ops = apply_filters( "spftestimonial_{$this->unique}_widget_ops", $widget_ops, $this );
49
- $control_ops = apply_filters( "spftestimonial_{$this->unique}_control_ops", $control_ops, $this );
50
-
51
- parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
52
-
53
- }
54
 
55
- // Register widget with WordPress
56
- public static function instance( $key, $params = array() ) {
57
- return new self( $key, $params );
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- // Front-end display of widget.
61
- public function widget( $args, $instance ) {
62
- call_user_func( $this->unique, $args, $instance );
63
- }
64
 
65
- // get default value
66
- public function get_default( $field, $options = array() ) {
67
 
68
- $default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : null;
69
- $default = ( isset( $field['default'] ) ) ? $field['default'] : $default;
70
- $default = ( isset( $options[$field['id']] ) ) ? $options[$field['id']] : $default;
71
 
72
- return $default;
 
73
 
74
- }
 
 
 
75
 
76
- // Back-end widget form.
77
- public function form( $instance ) {
78
 
79
- if( ! empty( $this->args['fields'] ) ) {
80
 
81
- $class = ( $this->args['class'] ) ? ' '. $this->args['class'] : '';
82
 
83
- echo '<div class="spftestimonial spftestimonial-widgets spftestimonial-fields'. $class .'">';
84
 
85
- foreach( $this->args['fields'] as $field ) {
86
 
87
- $field_value = '';
88
- $field_unique = '';
 
 
 
 
 
 
89
 
90
- if( ! empty( $field['id'] ) ) {
 
 
 
 
 
91
 
92
- $field_value = $this->get_default( $field, $instance );
93
- $field_unique = 'widget-' . $this->unique . '[' . $this->number . ']';
94
 
95
- if( $field['id'] === 'title' ) {
96
- $field['attributes']['id'] = 'widget-'. $this->unique .'-'. $this->number .'-title';
97
- }
98
 
99
- }
100
 
101
- SPFTESTIMONIAL::field( $field, $field_value, $field_unique );
102
-
103
- }
104
-
105
- echo '</div>';
106
-
107
- }
108
-
109
- }
110
-
111
- // Sanitize widget form values as they are saved.
112
- public function update( $new_instance, $old_instance ) {
113
-
114
- // auto sanitize
115
- foreach( $this->args['fields'] as $field ) {
116
- if( ! empty( $field['id'] ) && ( ! isset( $new_instance[$field['id']] ) || is_null( $new_instance[$field['id']] ) ) ) {
117
- $new_instance[$field['id']] = '';
118
- }
119
- }
120
-
121
- $new_instance = apply_filters( "spftestimonial_{$this->unique}_save", $new_instance, $this->args, $this );
122
-
123
- do_action( "spftestimonial_{$this->unique}_save_before", $new_instance, $this->args, $this );
124
-
125
- return $new_instance;
126
-
127
- }
128
- }
129
  }
 
1
+ <?php
2
  /**
3
+ * Framework widgets.class file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'SPFTESTIMONIAL_Widget' ) ) {
17
+ /**
18
+ *
19
+ * Widgets Class
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ class SPFTESTIMONIAL_Widget extends WP_Widget {
25
+
26
+
27
+ /**
28
+ * Unique
29
+ *
30
+ * @var string
31
+ */
32
+ public $unique = '';
33
+ /**
34
+ * Default args.
35
+ *
36
+ * @var array
37
+ */
38
+ public $args = array(
39
+ 'title' => '',
40
+ 'classname' => '',
41
+ 'description' => '',
42
+ 'width' => '',
43
+ 'defaults' => array(),
44
+ 'fields' => array(),
45
+ 'class' => '',
46
+ );
47
+
48
+ /**
49
+ * Widget construct
50
+ *
51
+ * @param mixed $key key.
52
+ * @param mixed $params params.
53
+ * @return void
54
+ */
55
+ public function __construct( $key, $params ) {
56
+
57
+ $widget_ops = array();
58
+ $control_ops = array();
59
+
60
+ $this->unique = $key;
61
+ $this->args = apply_filters( "spftestimonial_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this );
62
+
63
+ // Set control options.
64
+ if ( ! empty( $this->args['width'] ) ) {
65
+ $control_ops['width'] = $this->args['width'];
66
+ }
67
+
68
+ // Set widget options.
69
+ if ( ! empty( $this->args['description'] ) ) {
70
+ $widget_ops['description'] = $this->args['description'];
71
+ }
72
+
73
+ if ( ! empty( $this->args['classname'] ) ) {
74
+ $widget_ops['classname'] = $this->args['classname'];
75
+ }
76
+
77
+ // Set filters.
78
+ $widget_ops = apply_filters( "spftestimonial_{$this->unique}_widget_ops", $widget_ops, $this );
79
+ $control_ops = apply_filters( "spftestimonial_{$this->unique}_control_ops", $control_ops, $this );
80
+
81
+ parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
82
+
83
+ }
84
+
85
+ /**
86
+ * Register widget with WordPress.
87
+ *
88
+ * @param mixed $key key.
89
+ * @param mixed $params params.
90
+ * @return array
91
+ */
92
+ public static function instance( $key, $params = array() ) {
93
+
94
+ return new self( $key, $params );
95
+ }
96
+
97
+ /**
98
+ * Front-End display of widget.
99
+ *
100
+ * @param array $args args.
101
+ * @param mixed $instance instance.
102
+ * @return void
103
+ */
104
+ public function widget( $args, $instance ) {
105
+
106
+ call_user_func( $this->unique, $args, $instance );
107
+ }
108
+
109
+ /**
110
+ * Get default value
111
+ *
112
+ * @param array $field Field.
113
+ * @param array $options options.
114
+ * @return string
115
+ */
116
+ public function get_default( $field, $options = array() ) {
117
+
118
+ $default = ( isset( $this->args['defaults'][ $field['id'] ] ) ) ? $this->args['defaults'][ $field['id'] ] : null;
119
+ $default = ( isset( $field['default'] ) ) ? $field['default'] : $default;
120
+ $default = ( isset( $options[ $field['id'] ] ) ) ? $options[ $field['id'] ] : $default;
121
+
122
+ return $default;
123
+
124
+ }
125
+
126
+ /**
127
+ * Back-end widget form.
128
+ *
129
+ * @param mixed $instance instance.
130
+ * @return void
131
+ */
132
+ public function form( $instance ) {
133
+
134
+ if ( ! empty( $this->args['fields'] ) ) {
135
+
136
+ $class = ( $this->args['class'] ) ? ' ' . $this->args['class'] : '';
137
+
138
+ echo '<div class="spftestimonial spftestimonial-widgets spftestimonial-fields' . esc_attr( $class ) . '">';
139
 
140
+ foreach ( $this->args['fields'] as $field ) {
 
 
 
141
 
142
+ $field_value = '';
143
+ $field_unique = '';
144
 
145
+ if ( ! empty( $field['id'] ) ) {
 
 
146
 
147
+ $field_value = $this->get_default( $field, $instance );
148
+ $field_unique = 'widget-' . $this->unique . '[' . $this->number . ']';
149
 
150
+ if ( 'title' === $field['id'] ) {
151
+ $field['attributes']['id'] = 'widget-' . $this->unique . '-' . $this->number . '-title';
152
+ }
153
+ }
154
 
155
+ SPFTESTIMONIAL::field( $field, $field_value, $field_unique );
 
156
 
157
+ }
158
 
159
+ echo '</div>';
160
 
161
+ }
162
 
163
+ }
164
 
165
+ /**
166
+ * Sanitize widget form values as they are saved.
167
+ *
168
+ * @param mixed $new_instance instance.
169
+ * @param mixed $old_instance instance.
170
+ * @return statement
171
+ */
172
+ public function update( $new_instance, $old_instance ) {
173
 
174
+ // auto sanitize.
175
+ foreach ( $this->args['fields'] as $field ) {
176
+ if ( ! empty( $field['id'] ) && ( ! isset( $new_instance[ $field['id'] ] ) || is_null( $new_instance[ $field['id'] ] ) ) ) {
177
+ $new_instance[ $field['id'] ] = '';
178
+ }
179
+ }
180
 
181
+ $new_instance = apply_filters( "spftestimonial_{$this->unique}_save", $new_instance, $this->args, $this );
 
182
 
183
+ do_action( "spftestimonial_{$this->unique}_save_before", $new_instance, $this->args, $this );
 
 
184
 
185
+ return $new_instance;
186
 
187
+ }
188
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  }
190
+
admin/views/framework/fields/accordion/accordion.php CHANGED
@@ -1,27 +1,52 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Field: accordion
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_accordion' ) ) {
 
 
 
 
 
 
 
12
  class SPFTESTIMONIAL_Field_accordion extends SPFTESTIMONIAL_Fields {
13
 
14
-
 
 
 
 
 
 
 
 
15
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
- parent::__construct( $field, $value, $unique, $where, $parent );
18
  }
19
 
 
 
 
 
 
20
  public function render() {
21
 
22
  $unallows = array( 'accordion' );
23
 
24
- echo $this->field_before();
25
 
26
  echo '<div class="spftestimonial-accordion-items">';
27
 
@@ -32,15 +57,15 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_accordion' ) ) {
32
  $icon = ( ! empty( $accordion['icon'] ) ) ? 'spftestimonial--icon ' . $accordion['icon'] : 'spftestimonial-accordion-icon fa fa-angle-right';
33
 
34
  echo '<h4 class="spftestimonial-accordion-title">';
35
- echo '<i class="' . $icon . '"></i>';
36
- echo $accordion['title'];
37
  echo '</h4>';
38
 
39
  echo '<div class="spftestimonial-accordion-content">';
40
  if ( isset( $accordion['fields'] ) && is_array( $accordion['fields'] ) ) {
41
  foreach ( $accordion['fields'] as $field ) {
42
 
43
- if ( in_array( $field['type'], $unallows ) ) {
44
  $field['_notice'] = true;
45
  }
46
 
@@ -60,7 +85,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_accordion' ) ) {
60
  }
61
  echo '</div>';
62
 
63
- echo $this->field_after();
64
 
65
  }
66
 
1
+ <?php
 
 
2
  /**
3
+ * Framework accordion field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_accordion' ) ) {
17
+ /**
18
+ *
19
+ * Field: accordion
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
  class SPFTESTIMONIAL_Field_accordion extends SPFTESTIMONIAL_Fields {
25
 
26
+ /**
27
+ * Column field constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
36
 
37
+ parent::__construct( $field, $value, $unique, $where, $parent );
38
  }
39
 
40
+ /**
41
+ * Render field
42
+ *
43
+ * @return void
44
+ */
45
  public function render() {
46
 
47
  $unallows = array( 'accordion' );
48
 
49
+ echo wp_kses_post( $this->field_before() );
50
 
51
  echo '<div class="spftestimonial-accordion-items">';
52
 
57
  $icon = ( ! empty( $accordion['icon'] ) ) ? 'spftestimonial--icon ' . $accordion['icon'] : 'spftestimonial-accordion-icon fa fa-angle-right';
58
 
59
  echo '<h4 class="spftestimonial-accordion-title">';
60
+ echo '<i class="' . esc_attr( $icon ) . '"></i>';
61
+ echo wp_kses_post( $accordion['title'] );
62
  echo '</h4>';
63
 
64
  echo '<div class="spftestimonial-accordion-content">';
65
  if ( isset( $accordion['fields'] ) && is_array( $accordion['fields'] ) ) {
66
  foreach ( $accordion['fields'] as $field ) {
67
 
68
+ if ( in_array( $field['type'], $unallows, true ) ) {
69
  $field['_notice'] = true;
70
  }
71
 
85
  }
86
  echo '</div>';
87
 
88
+ echo wp_kses_post( $this->field_after() );
89
 
90
  }
91
 
admin/views/framework/fields/background/background.php DELETED
@@ -1,332 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: background
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_background' ) ) {
11
- class SPFTESTIMONIAL_Field_background extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'background_color' => true,
21
- 'background_image' => true,
22
- 'background_position' => true,
23
- 'background_repeat' => true,
24
- 'background_attachment' => true,
25
- 'background_size' => true,
26
- 'background_origin' => false,
27
- 'background_clip' => false,
28
- 'background_blend_mode' => false,
29
- 'background_gradient' => false,
30
- 'background_gradient_color' => true,
31
- 'background_gradient_direction' => true,
32
- 'background_image_preview' => true,
33
- 'background_auto_attributes' => false,
34
- 'background_image_library' => 'image',
35
- 'background_image_placeholder' => esc_html__( 'No background selected', 'testimonial-free' ),
36
- ) );
37
-
38
- $default_value = array(
39
- 'background-color' => '',
40
- 'background-image' => '',
41
- 'background-position' => '',
42
- 'background-repeat' => '',
43
- 'background-attachment' => '',
44
- 'background-size' => '',
45
- 'background-origin' => '',
46
- 'background-clip' => '',
47
- 'background-blend-mode' => '',
48
- 'background-gradient-color' => '',
49
- 'background-gradient-direction' => '',
50
- );
51
-
52
- $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
53
-
54
- $this->value = wp_parse_args( $this->value, $default_value );
55
-
56
- echo $this->field_before();
57
-
58
- echo '<div class="spftestimonial--background-colors">';
59
-
60
- //
61
- // Background Color
62
- if( ! empty( $args['background_color'] ) ) {
63
-
64
- echo '<div class="spftestimonial--color">';
65
-
66
- echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="spftestimonial--title">'. esc_html__( 'From', 'testimonial-free' ) .'</div>' : '';
67
-
68
- SPFTESTIMONIAL::field( array(
69
- 'id' => 'background-color',
70
- 'type' => 'color',
71
- 'default' => $default_value['background-color'],
72
- ), $this->value['background-color'], $this->field_name(), 'field/background' );
73
-
74
- echo '</div>';
75
-
76
- }
77
-
78
- //
79
- // Background Gradient Color
80
- if( ! empty( $args['background_gradient_color'] ) && ! empty( $args['background_gradient'] ) ) {
81
-
82
- echo '<div class="spftestimonial--color">';
83
-
84
- echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="spftestimonial--title">'. esc_html__( 'To', 'testimonial-free' ) .'</div>' : '';
85
-
86
- SPFTESTIMONIAL::field( array(
87
- 'id' => 'background-gradient-color',
88
- 'type' => 'color',
89
- 'default' => $default_value['background-gradient-color'],
90
- ), $this->value['background-gradient-color'], $this->field_name(), 'field/background' );
91
-
92
- echo '</div>';
93
-
94
- }
95
-
96
- //
97
- // Background Gradient Direction
98
- if( ! empty( $args['background_gradient_direction'] ) && ! empty( $args['background_gradient'] ) ) {
99
-
100
- echo '<div class="spftestimonial--color">';
101
-
102
- echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="spftestimonial---title">'. esc_html__( 'Direction', 'testimonial-free' ) .'</div>' : '';
103
-
104
- SPFTESTIMONIAL::field( array(
105
- 'id' => 'background-gradient-direction',
106
- 'type' => 'select',
107
- 'options' => array(
108
- '' => esc_html__( 'Gradient Direction', 'testimonial-free' ),
109
- 'to bottom' => esc_html__( '&#8659; top to bottom', 'testimonial-free' ),
110
- 'to right' => esc_html__( '&#8658; left to right', 'testimonial-free' ),
111
- '135deg' => esc_html__( '&#8664; corner top to right', 'testimonial-free' ),
112
- '-135deg' => esc_html__( '&#8665; corner top to left', 'testimonial-free' ),
113
- ),
114
- ), $this->value['background-gradient-direction'], $this->field_name(), 'field/background' );
115
-
116
- echo '</div>';
117
-
118
- }
119
-
120
- echo '</div>';
121
-
122
- //
123
- // Background Image
124
- if( ! empty( $args['background_image'] ) ) {
125
-
126
- echo '<div class="spftestimonial--background-image">';
127
-
128
- SPFTESTIMONIAL::field( array(
129
- 'id' => 'background-image',
130
- 'type' => 'media',
131
- 'class' => 'spftestimonial-assign-field-background',
132
- 'library' => $args['background_image_library'],
133
- 'preview' => $args['background_image_preview'],
134
- 'placeholder' => $args['background_image_placeholder'],
135
- 'attributes' => array( 'data-depend-id' => $this->field['id'] ),
136
- ), $this->value['background-image'], $this->field_name(), 'field/background' );
137
-
138
- echo '</div>';
139
-
140
- }
141
-
142
- $auto_class = ( ! empty( $args['background_auto_attributes'] ) ) ? ' spftestimonial--auto-attributes' : '';
143
- $hidden_class = ( ! empty( $args['background_auto_attributes'] ) && empty( $this->value['background-image']['url'] ) ) ? ' spftestimonial--attributes-hidden' : '';
144
-
145
- echo '<div class="spftestimonial--background-attributes'. $auto_class . $hidden_class .'">';
146
-
147
- //
148
- // Background Position
149
- if( ! empty( $args['background_position'] ) ) {
150
-
151
- SPFTESTIMONIAL::field( array(
152
- 'id' => 'background-position',
153
- 'type' => 'select',
154
- 'options' => array(
155
- '' => esc_html__( 'Background Position', 'testimonial-free' ),
156
- 'left top' => esc_html__( 'Left Top', 'testimonial-free' ),
157
- 'left center' => esc_html__( 'Left Center', 'testimonial-free' ),
158
- 'left bottom' => esc_html__( 'Left Bottom', 'testimonial-free' ),
159
- 'center top' => esc_html__( 'Center Top', 'testimonial-free' ),
160
- 'center center' => esc_html__( 'Center Center', 'testimonial-free' ),
161
- 'center bottom' => esc_html__( 'Center Bottom', 'testimonial-free' ),
162
- 'right top' => esc_html__( 'Right Top', 'testimonial-free' ),
163
- 'right center' => esc_html__( 'Right Center', 'testimonial-free' ),
164
- 'right bottom' => esc_html__( 'Right Bottom', 'testimonial-free' ),
165
- ),
166
- ), $this->value['background-position'], $this->field_name(), 'field/background' );
167
-
168
- }
169
-
170
- //
171
- // Background Repeat
172
- if( ! empty( $args['background_repeat'] ) ) {
173
-
174
- SPFTESTIMONIAL::field( array(
175
- 'id' => 'background-repeat',
176
- 'type' => 'select',
177
- 'options' => array(
178
- '' => esc_html__( 'Background Repeat', 'testimonial-free' ),
179
- 'repeat' => esc_html__( 'Repeat', 'testimonial-free' ),
180
- 'no-repeat' => esc_html__( 'No Repeat', 'testimonial-free' ),
181
- 'repeat-x' => esc_html__( 'Repeat Horizontally', 'testimonial-free' ),
182
- 'repeat-y' => esc_html__( 'Repeat Vertically', 'testimonial-free' ),
183
- ),
184
- ), $this->value['background-repeat'], $this->field_name(), 'field/background' );
185
-
186
- }
187
-
188
- //
189
- // Background Attachment
190
- if( ! empty( $args['background_attachment'] ) ) {
191
-
192
- SPFTESTIMONIAL::field( array(
193
- 'id' => 'background-attachment',
194
- 'type' => 'select',
195
- 'options' => array(
196
- '' => esc_html__( 'Background Attachment', 'testimonial-free' ),
197
- 'scroll' => esc_html__( 'Scroll', 'testimonial-free' ),
198
- 'fixed' => esc_html__( 'Fixed', 'testimonial-free' ),
199
- ),
200
- ), $this->value['background-attachment'], $this->field_name(), 'field/background' );
201
-
202
- }
203
-
204
- //
205
- // Background Size
206
- if( ! empty( $args['background_size'] ) ) {
207
-
208
- SPFTESTIMONIAL::field( array(
209
- 'id' => 'background-size',
210
- 'type' => 'select',
211
- 'options' => array(
212
- '' => esc_html__( 'Background Size', 'testimonial-free' ),
213
- 'cover' => esc_html__( 'Cover', 'testimonial-free' ),
214
- 'contain' => esc_html__( 'Contain', 'testimonial-free' ),
215
- ),
216
- ), $this->value['background-size'], $this->field_name(), 'field/background' );
217
-
218
- }
219
-
220
- //
221
- // Background Origin
222
- if( ! empty( $args['background_origin'] ) ) {
223
-
224
- SPFTESTIMONIAL::field( array(
225
- 'id' => 'background-origin',
226
- 'type' => 'select',
227
- 'options' => array(
228
- '' => esc_html__( 'Background Origin', 'testimonial-free' ),
229
- 'padding-box' => esc_html__( 'Padding Box', 'testimonial-free' ),
230
- 'border-box' => esc_html__( 'Border Box', 'testimonial-free' ),
231
- 'content-box' => esc_html__( 'Content Box', 'testimonial-free' ),
232
- ),
233
- ), $this->value['background-origin'], $this->field_name(), 'field/background' );
234
-
235
- }
236
-
237
- //
238
- // Background Clip
239
- if( ! empty( $args['background_clip'] ) ) {
240
-
241
- SPFTESTIMONIAL::field( array(
242
- 'id' => 'background-clip',
243
- 'type' => 'select',
244
- 'options' => array(
245
- '' => esc_html__( 'Background Clip', 'testimonial-free' ),
246
- 'border-box' => esc_html__( 'Border Box', 'testimonial-free' ),
247
- 'padding-box' => esc_html__( 'Padding Box', 'testimonial-free' ),
248
- 'content-box' => esc_html__( 'Content Box', 'testimonial-free' ),
249
- ),
250
- ), $this->value['background-clip'], $this->field_name(), 'field/background' );
251
-
252
- }
253
-
254
- //
255
- // Background Blend Mode
256
- if( ! empty( $args['background_blend_mode'] ) ) {
257
-
258
- SPFTESTIMONIAL::field( array(
259
- 'id' => 'background-blend-mode',
260
- 'type' => 'select',
261
- 'options' => array(
262
- '' => esc_html__( 'Background Blend Mode', 'testimonial-free' ),
263
- 'normal' => esc_html__( 'Normal', 'testimonial-free' ),
264
- 'multiply' => esc_html__( 'Multiply', 'testimonial-free' ),
265
- 'screen' => esc_html__( 'Screen', 'testimonial-free' ),
266
- 'overlay' => esc_html__( 'Overlay', 'testimonial-free' ),
267
- 'darken' => esc_html__( 'Darken', 'testimonial-free' ),
268
- 'lighten' => esc_html__( 'Lighten', 'testimonial-free' ),
269
- 'color-dodge' => esc_html__( 'Color Dodge', 'testimonial-free' ),
270
- 'saturation' => esc_html__( 'Saturation', 'testimonial-free' ),
271
- 'color' => esc_html__( 'Color', 'testimonial-free' ),
272
- 'luminosity' => esc_html__( 'Luminosity', 'testimonial-free' ),
273
- ),
274
- ), $this->value['background-blend-mode'], $this->field_name(), 'field/background' );
275
-
276
- }
277
-
278
- echo '</div>';
279
-
280
- echo $this->field_after();
281
-
282
- }
283
-
284
- public function output() {
285
-
286
- $output = '';
287
- $bg_image = array();
288
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
289
- $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
290
-
291
- // Background image and gradient
292
- $background_color = ( ! empty( $this->value['background-color'] ) ) ? $this->value['background-color'] : '';
293
- $background_gd_color = ( ! empty( $this->value['background-gradient-color'] ) ) ? $this->value['background-gradient-color'] : '';
294
- $background_gd_direction = ( ! empty( $this->value['background-gradient-direction'] ) ) ? $this->value['background-gradient-direction'] : '';
295
- $background_image = ( ! empty( $this->value['background-image']['url'] ) ) ? $this->value['background-image']['url'] : '';
296
-
297
-
298
- if( $background_color && $background_gd_color ) {
299
- $gd_direction = ( $background_gd_direction ) ? $background_gd_direction .',' : '';
300
- $bg_image[] = 'linear-gradient('. $gd_direction . $background_color .','. $background_gd_color .')';
301
- }
302
-
303
- if( $background_image ) {
304
- $bg_image[] = 'url('. $background_image .')';
305
- }
306
-
307
- if( ! empty( $bg_image ) ) {
308
- $output .= 'background-image:'. implode( ',', $bg_image ) . $important .';';
309
- }
310
-
311
- // Common background properties
312
- $properties = array( 'color', 'position', 'repeat', 'attachment', 'size', 'origin', 'clip', 'blend-mode' );
313
-
314
- foreach( $properties as $property ) {
315
- $property = 'background-'. $property;
316
- if( ! empty( $this->value[$property] ) ) {
317
- $output .= $property .':'. $this->value[$property] . $important .';';
318
- }
319
- }
320
-
321
- if( $output ) {
322
- $output = $element .'{'. $output .'}';
323
- }
324
-
325
- $this->parent->output_css .= $output;
326
-
327
- return $output;
328
-
329
- }
330
-
331
- }
332
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/backup/backup.php DELETED
@@ -1,42 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: backup
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_backup' ) ) {
11
- class SPFTESTIMONIAL_Field_backup extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $unique = $this->unique;
20
- $nonce = wp_create_nonce( 'spftestimonial_backup_nonce' );
21
- $export = add_query_arg( array( 'action' => 'spftestimonial-export', 'export' => $unique, 'nonce' => $nonce ), admin_url( 'admin-ajax.php' ) );
22
-
23
- echo $this->field_before();
24
-
25
- echo '<textarea name="spftestimonial_transient[spftestimonial_import_data]" class="spftestimonial-import-data"></textarea>';
26
- echo '<button type="submit" class="button button-primary spftestimonial-confirm spftestimonial-import" data-unique="'. $unique .'" data-nonce="'. $nonce .'">'. esc_html__( 'Import', 'testimonial-free' ) .'</button>';
27
- echo '<small>( '. esc_html__( 'copy-paste your backup string here', 'testimonial-free' ).' )</small>';
28
-
29
- echo '<hr />';
30
- echo '<textarea readonly="readonly" class="spftestimonial-export-data">'. json_encode( get_option( $unique ) ) .'</textarea>';
31
- echo '<a href="'. esc_url( $export ) .'" class="button button-primary spftestimonial-export" target="_blank">'. esc_html__( 'Export and Download Backup', 'testimonial-free' ) .'</a>';
32
-
33
- echo '<hr />';
34
- echo '<button type="submit" name="spftestimonial_transient[spftestimonial_reset_all]" value="spftestimonial_reset_all" class="button spftestimonial-warning-primary spftestimonial-confirm spftestimonial-reset" data-unique="'. $unique .'" data-nonce="'. $nonce .'">'. esc_html__( 'Reset All', 'testimonial-free' ) .'</button>';
35
- echo '<small class="spftestimonial-text-error">'. esc_html__( 'Please be sure for reset all of options.', 'testimonial-free' ) .'</small>';
36
-
37
- echo $this->field_after();
38
-
39
- }
40
-
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/border/border.php CHANGED
@@ -1,148 +1,176 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: border
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_border' ) ) {
11
- class SPFTESTIMONIAL_Field_border extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'top_icon' => '<i class="fa fa-long-arrow-up"></i>',
21
- 'left_icon' => '<i class="fa fa-long-arrow-left"></i>',
22
- 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>',
23
- 'right_icon' => '<i class="fa fa-long-arrow-right"></i>',
24
- 'all_icon' => '<i class="fa fa-arrows"></i>',
25
- 'top_placeholder' => esc_html__( 'top', 'testimonial-free' ),
26
- 'right_placeholder' => esc_html__( 'right', 'testimonial-free' ),
27
- 'bottom_placeholder' => esc_html__( 'bottom', 'testimonial-free' ),
28
- 'left_placeholder' => esc_html__( 'left', 'testimonial-free' ),
29
- 'all_placeholder' => esc_html__( 'all', 'testimonial-free' ),
30
- 'top' => true,
31
- 'left' => true,
32
- 'bottom' => true,
33
- 'right' => true,
34
- 'all' => false,
35
- 'color' => true,
36
- 'hover_color' => false,
37
- 'style' => true,
38
- 'unit' => 'px',
39
- ) );
40
-
41
- $default_value = array(
42
- 'top' => '',
43
- 'right' => '',
44
- 'bottom' => '',
45
- 'left' => '',
46
- 'color' => '',
47
- 'hover-color' => '',
48
- 'style' => 'solid',
49
- 'all' => '',
50
- );
51
-
52
- $border_props = array(
53
- 'solid' => esc_html__( 'Solid', 'testimonial-free' ),
54
- 'dashed' => esc_html__( 'Dashed', 'testimonial-free' ),
55
- 'dotted' => esc_html__( 'Dotted', 'testimonial-free' ),
56
- 'double' => esc_html__( 'Double', 'testimonial-free' ),
57
- 'inset' => esc_html__( 'Inset', 'testimonial-free' ),
58
- 'outset' => esc_html__( 'Outset', 'testimonial-free' ),
59
- 'groove' => esc_html__( 'Groove', 'testimonial-free' ),
60
- 'ridge' => esc_html__( 'ridge', 'testimonial-free' ),
61
- 'none' => esc_html__( 'None', 'testimonial-free' )
62
- );
63
-
64
- $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
65
-
66
- $value = wp_parse_args( $this->value, $default_value );
67
-
68
- echo $this->field_before();
69
-
70
- echo '<div class="spftestimonial--inputs">';
71
-
72
- if( ! empty( $args['all'] ) ) {
73
-
74
- $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="'. $args['all_placeholder'] .'"' : '';
75
-
76
- echo '<div class="spftestimonial--input">';
77
- echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args['all_icon'] .'</span>' : '';
78
- echo '<input type="number" name="'. $this->field_name('[all]') .'" value="'. $value['all'] .'"'. $placeholder .' class="spftestimonial-input-number spftestimonial--is-unit" />';
79
- echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['unit'] .'</span>' : '';
80
- echo '</div>';
81
-
82
- } else {
83
-
84
- $properties = array();
85
-
86
- foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
87
- if( ! empty( $args[$prop] ) ) {
88
- $properties[] = $prop;
89
- }
90
- }
91
-
92
- $properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties;
93
-
94
- foreach( $properties as $property ) {
95
-
96
- $placeholder = ( ! empty( $args[$property.'_placeholder'] ) ) ? ' placeholder="'. $args[$property.'_placeholder'] .'"' : '';
97
-
98
- echo '<div class="spftestimonial--input">';
99
- echo ( ! empty( $args[$property.'_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args[$property.'_icon'] .'</span>' : '';
100
- echo '<input type="number" name="'. $this->field_name('['. $property .']') .'" value="'. $value[$property] .'"'. $placeholder .' class="spftestimonial-input-number spftestimonial--is-unit" />';
101
- echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['unit'] .'</span>' : '';
102
- echo '</div>';
103
-
104
- }
105
-
106
- }
107
-
108
- if( ! empty( $args['style'] ) ) {
109
- echo '<div class="spftestimonial--input">';
110
- echo '<select name="'. $this->field_name('[style]') .'">';
111
- foreach( $border_props as $border_prop_key => $border_prop_value ) {
112
- $selected = ( $value['style'] === $border_prop_key ) ? ' selected' : '';
113
- echo '<option value="'. $border_prop_key .'"'. $selected .'>'. $border_prop_value .'</option>';
114
- }
115
- echo '</select>';
116
- echo '</div>';
117
- }
118
-
119
- echo '</div>';
120
-
121
- if( ! empty( $args['color'] ) ) {
122
- $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="'. $default_value['color'] .'"' : '';
123
- echo '<div class="spftestimonial--color">';
124
- echo '<div class="spftestimonial-field-color">';
125
- echo '<div class="spftestimonial--title">'. esc_html( 'Color', 'testimonial-free' ).'</div>';
126
- echo '<input type="text" name="'. $this->field_name('[color]') .'" value="'. $value['color'] .'" class="spftestimonial-color"'. $default_color_attr .' />';
127
- echo '</div>';
128
- echo '</div>';
129
- }
130
-
131
- if( ! empty( $args['hover_color'] ) ) {
132
- $default_hover_color_attr = ( ! empty( $default_value['hover-color'] ) ) ? ' data-default-color="'. $default_value['hover-color'] .'"' : '';
133
- echo '<div class="spftestimonial--color">';
134
- echo '<div class="spftestimonial-field-color">';
135
- echo '<div class="spftestimonial--title">'. esc_html( 'Hover Color', 'testimonial-free' ).'</div>';
136
- echo '<input type="text" name="'. $this->field_name('[hover-color]') .'" value="'. $value['hover-color'] .'" class="spftestimonial-color"'. $default_hover_color_attr .' />';
137
- echo '</div>';
138
- echo '</div>';
139
- }
140
-
141
- echo '<div class="clear"></div>';
142
-
143
- echo $this->field_after();
144
-
145
- }
146
 
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
1
+ <?php
2
  /**
3
+ * Framework border field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_border' ) ) {
16
+ /**
17
+ *
18
+ * Field: border
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_border extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'top_icon' => '<i class="fa fa-long-arrow-up"></i>',
49
+ 'left_icon' => '<i class="fa fa-long-arrow-left"></i>',
50
+ 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>',
51
+ 'right_icon' => '<i class="fa fa-long-arrow-right"></i>',
52
+ 'all_icon' => '<i class="fa fa-arrows"></i>',
53
+ 'top_placeholder' => esc_html__( 'top', 'testimonial-free' ),
54
+ 'right_placeholder' => esc_html__( 'right', 'testimonial-free' ),
55
+ 'bottom_placeholder' => esc_html__( 'bottom', 'testimonial-free' ),
56
+ 'left_placeholder' => esc_html__( 'left', 'testimonial-free' ),
57
+ 'all_placeholder' => esc_html__( 'all', 'testimonial-free' ),
58
+ 'top' => true,
59
+ 'left' => true,
60
+ 'bottom' => true,
61
+ 'right' => true,
62
+ 'all' => false,
63
+ 'color' => true,
64
+ 'hover_color' => false,
65
+ 'style' => true,
66
+ 'unit' => 'px',
67
+ )
68
+ );
69
+
70
+ $default_value = array(
71
+ 'top' => '',
72
+ 'right' => '',
73
+ 'bottom' => '',
74
+ 'left' => '',
75
+ 'color' => '',
76
+ 'hover-color' => '',
77
+ 'style' => 'solid',
78
+ 'all' => '',
79
+ );
80
+
81
+ $border_props = array(
82
+ 'solid' => esc_html__( 'Solid', 'testimonial-free' ),
83
+ 'dashed' => esc_html__( 'Dashed', 'testimonial-free' ),
84
+ 'dotted' => esc_html__( 'Dotted', 'testimonial-free' ),
85
+ 'double' => esc_html__( 'Double', 'testimonial-free' ),
86
+ 'inset' => esc_html__( 'Inset', 'testimonial-free' ),
87
+ 'outset' => esc_html__( 'Outset', 'testimonial-free' ),
88
+ 'groove' => esc_html__( 'Groove', 'testimonial-free' ),
89
+ 'ridge' => esc_html__( 'ridge', 'testimonial-free' ),
90
+ 'none' => esc_html__( 'None', 'testimonial-free' ),
91
+ );
92
+
93
+ $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
94
+
95
+ $value = wp_parse_args( $this->value, $default_value );
96
+
97
+ echo wp_kses_post( $this->field_before() );
98
+
99
+ echo '<div class="spftestimonial--inputs">';
100
+
101
+ if ( ! empty( $args['all'] ) ) {
102
+
103
+ $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : '';
104
+
105
+ echo '<div class="spftestimonial--input">';
106
+ echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : '';
107
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[all]' ) ) . '" value="' . esc_attr( $value['all'] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-input-number spftestimonial--is-unit" />';
108
+ echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>' : '';
109
+ echo '</div>';
110
+
111
+ } else {
112
+
113
+ $properties = array();
114
+
115
+ foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
116
+ if ( ! empty( $args[ $prop ] ) ) {
117
+ $properties[] = $prop;
118
+ }
119
+ }
120
+
121
+ $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties;
122
+
123
+ foreach ( $properties as $property ) {
124
+
125
+ $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
126
+
127
+ echo '<div class="spftestimonial--input">';
128
+ echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
129
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-input-number spftestimonial--is-unit" />';
130
+ echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>' : '';
131
+ echo '</div>';
132
+
133
+ }
134
+ }
135
+
136
+ if ( ! empty( $args['style'] ) ) {
137
+ echo '<div class="spftestimonial--input">';
138
+ echo '<select name="' . esc_attr( $this->field_name( '[style]' ) ) . '">';
139
+ foreach ( $border_props as $border_prop_key => $border_prop_value ) {
140
+ $selected = ( $value['style'] === $border_prop_key ) ? ' selected' : '';
141
+ echo '<option value="' . esc_attr( $border_prop_key ) . '"' . esc_attr( $selected ) . '>' . esc_html( $border_prop_value ) . '</option>';
142
+ }
143
+ echo '</select>';
144
+ echo '</div>';
145
+ }
146
+
147
+ echo '</div>';
148
+
149
+ if ( ! empty( $args['color'] ) ) {
150
+ $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : '';
151
+ echo '<div class="spftestimonial--color">';
152
+ echo '<div class="spftestimonial-field-color">';
153
+ echo '<div class="spftestimonial--title">' . esc_html__( 'Color', 'testimonial-free' ) . '</div>';
154
+ echo '<input type="text" name="' . esc_attr( $this->field_name( '[color]' ) ) . '" value="' . esc_attr( $value['color'] ) . '" class="spftestimonial-color"' . wp_kses_post( $default_color_attr ) . ' />';
155
+ echo '</div>';
156
+ echo '</div>';
157
+ }
158
+
159
+ if ( ! empty( $args['hover_color'] ) ) {
160
+ $default_hover_color_attr = ( ! empty( $default_value['hover-color'] ) ) ? ' data-default-color="' . $default_value['hover-color'] . '"' : '';
161
+ echo '<div class="spftestimonial--color">';
162
+ echo '<div class="spftestimonial-field-color">';
163
+ echo '<div class="spftestimonial--title">' . esc_html__( 'Hover Color', 'testimonial-free' ) . '</div>';
164
+ echo '<input type="text" name="' . esc_attr( $this->field_name( '[hover-color]' ) ) . '" value="' . esc_attr( $value['hover-color'] ) . '" class="spftestimonial-color"' . wp_kses_post( $default_hover_color_attr ) . ' />';
165
+ echo '</div>';
166
+ echo '</div>';
167
+ }
168
+
169
+ echo '<div class="clear"></div>';
170
+
171
+ echo wp_kses_post( $this->field_after() );
172
+
173
+ }
174
+
175
+ }
176
  }
admin/views/framework/fields/button_set/button_set.php CHANGED
@@ -1,22 +1,47 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Field: button_set
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_button_set' ) ) {
 
 
 
 
 
 
 
12
  class SPFTESTIMONIAL_Field_button_set extends SPFTESTIMONIAL_Fields {
13
 
14
-
 
 
 
 
 
 
 
 
15
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
  parent::__construct( $field, $value, $unique, $where, $parent );
18
  }
19
 
 
 
 
 
 
20
  public function render() {
21
 
22
  $args = wp_parse_args(
@@ -29,25 +54,26 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_button_set' ) ) {
29
 
30
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
31
 
32
- echo $this->field_before();
33
 
34
  if ( ! empty( $args['options'] ) ) {
35
 
36
- echo '<div class="spftestimonial-siblings spftestimonial--button-group" data-multiple="' . $args['multiple'] . '">';
37
 
38
  foreach ( $args['options'] as $key => $option ) {
39
 
40
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
41
  $extra = ( $args['multiple'] ) ? '[]' : '';
42
- $active = ( in_array( $key, $value ) || ( empty( $value ) && empty( $key ) ) ) ? ' spftestimonial--active' : '';
43
- $checked = ( in_array( $key, $value ) || ( empty( $value ) && empty( $key ) ) ) ? ' checked' : '';
44
- $pro_only_class = ( isset( $option['pro_only'] ) && $option['pro_only'] == true ) ? ' spftestimonial-pro-only' : '';
45
- echo '<div class="spftestimonial--sibling spftestimonial--button' . $active . $pro_only_class . '">';
46
- echo '<input type="' . $type . '" name="' . $this->field_name( $extra ) . '" value="' . $key . '"' . $this->field_attributes() . $checked . '/>';
 
47
  if ( isset( $option['option_name'] ) && ! empty( $option['option_name'] ) ) {
48
- echo $option['option_name'];
49
  } else {
50
- echo $option;
51
  }
52
  echo '</div>';
53
 
@@ -58,7 +84,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_button_set' ) ) {
58
  }
59
 
60
  echo '<div class="clear"></div>';
61
-
62
  echo $this->field_after();
63
 
64
  }
1
+ <?php
 
 
2
  /**
3
+ * Framework button_set field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_button_set' ) ) {
17
+ /**
18
+ *
19
+ * Field: button_set
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
  class SPFTESTIMONIAL_Field_button_set extends SPFTESTIMONIAL_Fields {
25
 
26
+ /**
27
+ * Field constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
36
 
37
  parent::__construct( $field, $value, $unique, $where, $parent );
38
  }
39
 
40
+ /**
41
+ * Render field
42
+ *
43
+ * @return void
44
+ */
45
  public function render() {
46
 
47
  $args = wp_parse_args(
54
 
55
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
56
 
57
+ echo wp_kses_post( $this->field_before() );
58
 
59
  if ( ! empty( $args['options'] ) ) {
60
 
61
+ echo '<div class="spftestimonial-siblings spftestimonial--button-group" data-multiple="' . esc_attr( $args['multiple'] ) . '">';
62
 
63
  foreach ( $args['options'] as $key => $option ) {
64
 
65
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
66
  $extra = ( $args['multiple'] ) ? '[]' : '';
67
+ $active = ( in_array( $key, $value, true ) || ( empty( $value ) && empty( $key ) ) ) ? ' spftestimonial--active' : '';
68
+ $checked = ( in_array( $key, $value, true ) || ( empty( $value ) && empty( $key ) ) ) ? ' checked' : '';
69
+ $pro_only_class = ( isset( $option['pro_only'] ) && true === $option['pro_only'] ) ? ' spftestimonial-pro-only' : '';
70
+ echo '<div class="spftestimonial--sibling spftestimonial--button' . esc_attr( $active . $pro_only_class ) . '">';
71
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
72
+ echo '<input type="' . esc_attr( $type ) . '" name="' . esc_attr( $this->field_name( $extra ) ) . '" value="' . esc_attr( $key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/>';
73
  if ( isset( $option['option_name'] ) && ! empty( $option['option_name'] ) ) {
74
+ echo esc_html( $option['option_name'] );
75
  } else {
76
+ echo esc_html( $option );
77
  }
78
  echo '</div>';
79
 
84
  }
85
 
86
  echo '<div class="clear"></div>';
87
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
88
  echo $this->field_after();
89
 
90
  }
admin/views/framework/fields/checkbox/checkbox.php CHANGED
@@ -1,82 +1,112 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: checkbox
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_checkbox' ) ) {
11
- class SPFTESTIMONIAL_Field_checkbox extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'inline' => false,
21
- 'query_args' => array(),
22
- ) );
23
-
24
- $inline_class = ( $args['inline'] ) ? ' class="spftestimonial--inline-list"' : '';
25
-
26
- echo $this->field_before();
27
-
28
- if( isset( $this->field['options'] ) ) {
29
-
30
- $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
31
- $options = $this->field['options'];
32
- $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
33
-
34
- if( is_array( $options ) && ! empty( $options ) ) {
35
-
36
- echo '<ul'. $inline_class .'>';
37
- foreach ( $options as $option_key => $option_value ) {
38
-
39
- if( is_array( $option_value ) && ! empty( $option_value ) ) {
40
-
41
- echo '<li>';
42
- echo '<ul>';
43
- echo '<li><strong>'. $option_key .'</strong></li>';
44
- foreach( $option_value as $sub_key => $sub_value ) {
45
- $checked = ( in_array( $sub_key, $value ) ) ? ' checked' : '';
46
- echo '<li><label><input type="checkbox" name="'. $this->field_name( '[]' ) .'" value="'. $sub_key .'"'. $this->field_attributes() . $checked .'/> '. $sub_value .'</label></li>';
47
- }
48
- echo '</ul>';
49
- echo '</li>';
50
-
51
- } else {
52
-
53
- $checked = ( in_array( $option_key, $value ) ) ? ' checked' : '';
54
- echo '<li><label><input type="checkbox" name="'. $this->field_name( '[]' ) .'" value="'. $option_key .'"'. $this->field_attributes() . $checked .'/> '. $option_value .'</label></li>';
55
-
56
- }
57
-
58
- }
59
- echo '</ul>';
60
-
61
- } else {
62
-
63
- echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
64
-
65
- }
66
-
67
- } else {
68
-
69
- echo '<label class="spftestimonial-checkbox">';
70
- echo '<input type="hidden" name="'. $this->field_name() .'" value="'. $this->value .'" class="spftestimonial--input"'. $this->field_attributes() .'/>';
71
- echo '<input type="checkbox" name="_pseudo" class="spftestimonial--checkbox"'. checked( $this->value, 1, false ) .'/>';
72
- echo ( ! empty( $this->field['label'] ) ) ? ' '. $this->field['label'] : '';
73
- echo '</label>';
74
-
75
- }
76
-
77
- echo $this->field_after();
78
-
79
- }
80
 
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
1
+ <?php
2
  /**
3
+ * Framework checkbox field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_checkbox' ) ) {
16
+ /**
17
+ *
18
+ * Field: checkbox
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_checkbox extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'inline' => false,
49
+ 'query_args' => array(),
50
+ )
51
+ );
52
+
53
+ $inline_class = ( $args['inline'] ) ? ' class="spftestimonial--inline-list"' : '';
54
+
55
+ echo wp_kses_post( $this->field_before() );
56
+
57
+ if ( isset( $this->field['options'] ) ) {
58
+
59
+ $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
60
+ $options = $this->field['options'];
61
+ $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
62
+
63
+ if ( is_array( $options ) && ! empty( $options ) ) {
64
+
65
+ echo '<ul' . wp_kses_post( $inline_class ) . '>';
66
+ foreach ( $options as $option_key => $option_value ) {
67
+
68
+ if ( is_array( $option_value ) && ! empty( $option_value ) ) {
69
+
70
+ echo '<li>';
71
+ echo '<ul>';
72
+ echo '<li><strong>' . esc_html( $option_key ) . '</strong></li>';
73
+ foreach ( $option_value as $sub_key => $sub_value ) {
74
+ $checked = ( in_array( $sub_key, $value, true ) ) ? ' checked' : '';
75
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
76
+ echo '<li><label><input type="checkbox" name="' . esc_attr( $this->field_name( '[]' ) ) . '" value="' . esc_attr( $sub_key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/> ' . esc_html( $sub_value ) . '</label></li>';
77
+ }
78
+ echo '</ul>';
79
+ echo '</li>';
80
+
81
+ } else {
82
+
83
+ $checked = ( in_array( $option_key, $value, true ) ) ? ' checked' : '';
84
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
85
+ echo '<li><label><input type="checkbox" name="' . esc_attr( $this->field_name( '[]' ) ) . '" value="' . esc_attr( $option_key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/> ' . esc_html( $option_value ) . '</label></li>';
86
+
87
+ }
88
+ }
89
+ echo '</ul>';
90
+
91
+ } else {
92
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
93
+ echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
94
+
95
+ }
96
+ } else {
97
+
98
+ echo '<label class="spftestimonial-checkbox">';
99
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
100
+ echo '<input type="hidden" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '" class="spftestimonial--input"' . $this->field_attributes() . '/>';
101
+ echo '<input type="checkbox" name="_pseudo" class="spftestimonial--checkbox"' . checked( $this->value, 1, false ) . '/>';
102
+ echo ( ! empty( $this->field['label'] ) ) ? ' ' . esc_html( $this->field['label'] ) : '';
103
+ echo '</label>';
104
+
105
+ }
106
+
107
+ echo wp_kses_post( $this->field_after() );
108
+
109
+ }
110
+
111
+ }
112
  }
admin/views/framework/fields/code_editor/code_editor.php CHANGED
@@ -1,60 +1,108 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: code_editor
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_code_editor' ) ) {
11
- class SPFTESTIMONIAL_Field_code_editor extends SPFTESTIMONIAL_Fields {
12
 
13
- public $version = '5.41.0';
14
- public $cdn_url = 'https://cdn.jsdelivr.net/npm/codemirror@';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
17
- parent::__construct( $field, $value, $unique, $where, $parent );
18
- }
 
 
 
 
 
 
 
19
 
20
- public function render() {
 
21
 
22
- $default_settings = array(
23
- 'tabSize' => 2,
24
- 'lineNumbers' => true,
25
- 'theme' => 'default',
26
- 'mode' => 'htmlmixed',
27
- 'cdnURL' => $this->cdn_url . $this->version,
28
- );
29
 
30
- $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
31
- $settings = wp_parse_args( $settings, $default_settings );
32
- $encoded = htmlspecialchars( json_encode( $settings ) );
 
 
 
 
33
 
34
- echo $this->field_before();
35
- echo '<textarea name="'. $this->field_name() .'"'. $this->field_attributes() .' data-editor="'. $encoded .'">'. $this->value .'</textarea>';
36
- echo $this->field_after();
37
 
38
- }
 
 
39
 
40
- public function enqueue() {
41
 
42
- $screen = get_current_screen();
43
- if ( $screen->post_type == 'spt_testimonial' || $screen->post_type == 'spt_shortcodes' ) {
44
- // Do not loads CodeMirror in revslider page.
45
- if( in_array( spftestimonial_get_var( 'page' ), array( 'revslider' ) ) ) { return; }
46
 
47
- if( ! wp_script_is( 'spftestimonial-codemirror' ) ) {
48
- wp_enqueue_script( 'spftestimonial-codemirror', $this->cdn_url . $this->version .'/lib/codemirror.min.js', array( 'spftestimonial' ), $this->version, true );
49
- wp_enqueue_script( 'spftestimonial-codemirror-loadmode', $this->cdn_url . $this->version .'/addon/mode/loadmode.min.js', array( 'spftestimonial-codemirror' ), $this->version, true );
50
- }
 
 
51
 
52
- if( ! wp_style_is( 'spftestimonial-codemirror' ) ) {
53
- wp_enqueue_style( 'spftestimonial-codemirror', $this->cdn_url . $this->version .'/lib/codemirror.min.css', array(), $this->version );
54
- }
55
- }
 
 
56
 
57
- }
 
 
 
58
 
59
- }
 
 
 
 
 
 
 
60
  }
 
1
+ <?php
2
  /**
3
+ * Framework accordion field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_code_editor' ) ) {
17
+ /**
18
+ *
19
+ * Field: code_editor
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ class SPFTESTIMONIAL_Field_code_editor extends SPFTESTIMONIAL_Fields {
25
+
26
+ /**
27
+ * Version
28
+ *
29
+ * @var string
30
+ */
31
+ public $version = '5.41.0';
32
+ /**
33
+ * Cdn_url
34
+ *
35
+ * @var string
36
+ */
37
+ public $cdn_url = 'https://cdn.jsdelivr.net/npm/codemirror@';
38
 
39
+ /**
40
+ * Field constructor.
41
+ *
42
+ * @param array $field The field type.
43
+ * @param string $value The values of the field.
44
+ * @param string $unique The unique ID for the field.
45
+ * @param string $where To where show the output CSS.
46
+ * @param string $parent The parent args.
47
+ */
48
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
49
 
50
+ parent::__construct( $field, $value, $unique, $where, $parent );
51
+ }
52
 
53
+ /**
54
+ * Render field
55
+ *
56
+ * @return void
57
+ */
58
+ public function render() {
 
59
 
60
+ $default_settings = array(
61
+ 'tabSize' => 2,
62
+ 'lineNumbers' => true,
63
+ 'theme' => 'default',
64
+ 'mode' => 'htmlmixed',
65
+ 'cdnURL' => $this->cdn_url . $this->version,
66
+ );
67
 
68
+ $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
69
+ $settings = wp_parse_args( $settings, $default_settings );
70
+ $encoded = htmlspecialchars( wp_json_encode( $settings ) );
71
 
72
+ echo wp_kses_post( $this->field_before() );
73
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
74
+ echo '<textarea name="' . esc_attr( $this->field_name() ) . '"' . $this->field_attributes() . ' data-editor="' . esc_attr( $encoded ) . '">' . wp_kses_post( $this->value ) . '</textarea>';
75
 
76
+ echo wp_kses_post( $this->field_after() );
77
 
78
+ }
 
 
 
79
 
80
+ /**
81
+ * Enqueue
82
+ *
83
+ * @return void
84
+ */
85
+ public function enqueue() {
86
 
87
+ $screen = get_current_screen();
88
+ if ( 'spt_testimonial' === $screen->post_type || 'spt_shortcodes' === $screen->post_type ) {
89
+ // Do not loads CodeMirror in revslider page.
90
+ if ( in_array( spftestimonial_get_var( 'page' ), array( 'revslider' ), true ) ) {
91
+ return;
92
+ }
93
 
94
+ if ( ! wp_script_is( 'spftestimonial-codemirror' ) ) {
95
+ wp_enqueue_script( 'spftestimonial-codemirror', $this->cdn_url . $this->version . '/lib/codemirror.min.js', array( 'spftestimonial' ), $this->version, true );
96
+ wp_enqueue_script( 'spftestimonial-codemirror-loadmode', $this->cdn_url . $this->version . '/addon/mode/loadmode.min.js', array( 'spftestimonial-codemirror' ), $this->version, true );
97
+ }
98
 
99
+ if ( ! wp_style_is( 'spftestimonial-codemirror' ) ) {
100
+ wp_enqueue_style( 'spftestimonial-codemirror', $this->cdn_url . $this->version . '/lib/codemirror.min.css', array(), $this->version );
101
+ }
102
+ }
103
+
104
+ }
105
+
106
+ }
107
  }
108
+
admin/views/framework/fields/color/color.php CHANGED
@@ -1,52 +1,87 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: color
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_color' ) ) {
11
- class SPFTESTIMONIAL_Field_color extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- $default_attr = ( ! empty( $this->field['default'] ) ) ? ' data-default-color="'. $this->field['default'] .'"' : '';
20
 
21
- echo $this->field_before();
22
- echo '<input type="text" name="'. $this->field_name() .'" value="'. $this->value .'" class="spftestimonial-color"'. $default_attr . $this->field_attributes() .'/>';
23
- echo $this->field_after();
24
 
25
- }
26
 
27
- public function output() {
28
 
29
- $output = '';
30
- $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
31
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
32
- $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'color';
 
 
33
 
34
- if( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
35
- foreach( $elements as $key_property => $element ) {
36
- if( is_numeric( $key_property ) ) {
37
- $output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $important .';}';
38
- break;
39
- } else {
40
- $output .= $element .'{'. $key_property .':'. $this->value . $important .'}';
41
- }
42
- }
43
- }
44
 
45
- $this->parent->output_css .= $output;
 
 
 
 
 
 
 
 
 
46
 
47
- return $output;
48
 
49
- }
50
 
51
- }
 
 
52
  }
 
1
+ <?php
2
  /**
3
+ * Framework color field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_color' ) ) {
17
+ /**
18
+ *
19
+ * Field: color
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ class SPFTESTIMONIAL_Field_color extends SPFTESTIMONIAL_Fields {
25
+
26
+ /**
27
+ * Field constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
36
+ parent::__construct( $field, $value, $unique, $where, $parent );
37
+ }
38
 
39
+ /**
40
+ * Render field
41
+ *
42
+ * @return void
43
+ */
44
+ public function render() {
45
 
46
+ $default_attr = ( ! empty( $this->field['default'] ) ) ? ' data-default-color="' . $this->field['default'] . '"' : '';
47
 
48
+ echo wp_kses_post( $this->field_before() );
49
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
50
+ echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '" class="spftestimonial-color"' . wp_kses_post( $default_attr ) . $this->field_attributes() . '/>';
51
 
52
+ echo wp_kses_post( $this->field_after() );
53
 
54
+ }
55
 
56
+ /**
57
+ * Output
58
+ *
59
+ * @return statement
60
+ */
61
+ public function output() {
62
 
63
+ $output = '';
64
+ $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
65
+ $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
66
+ $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'color';
 
 
 
 
 
 
67
 
68
+ if ( ! empty( $elements ) && isset( $this->value ) && '' !== $this->value ) {
69
+ foreach ( $elements as $key_property => $element ) {
70
+ if ( is_numeric( $key_property ) ) {
71
+ $output = implode( ',', $elements ) . '{' . $mode . ':' . $this->value . $important . ';}';
72
+ break;
73
+ } else {
74
+ $output .= $element . '{' . $key_property . ':' . $this->value . $important . '}';
75
+ }
76
+ }
77
+ }
78
 
79
+ $this->parent->output_css .= $output;
80
 
81
+ return $output;
82
 
83
+ }
84
+
85
+ }
86
  }
87
+
admin/views/framework/fields/color_group/color_group.php CHANGED
@@ -1,44 +1,70 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: color_group
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_color_group' ) ) {
11
- class SPFTESTIMONIAL_Field_color_group extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- $options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
20
 
21
- echo $this->field_before();
22
 
23
- if( ! empty( $options ) ) {
24
- foreach( $options as $key => $option ) {
25
 
26
- $color_value = ( ! empty( $this->value[$key] ) ) ? $this->value[$key] : '';
27
- $default_attr = ( ! empty( $this->field['default'][$key] ) ) ? ' data-default-color="'. $this->field['default'][$key] .'"' : '';
28
 
29
- echo '<div class="spftestimonial--left spftestimonial-field-color">';
30
- echo '<div class="spftestimonial--title">'. $option .'</div>';
31
- echo '<input type="text" name="'. $this->field_name('['. $key .']') .'" value="'. $color_value .'" class="spftestimonial-color"'. $default_attr . $this->field_attributes() .'/>';
32
- echo '</div>';
 
33
 
34
- }
35
- }
36
 
37
- echo '<div class="clear"></div>';
38
 
39
- echo $this->field_after();
40
 
41
- }
42
 
43
- }
44
  }
1
+ <?php
2
  /**
3
+ * Framework color_group field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_color_group' ) ) {
16
+ /**
17
+ *
18
+ * Field: color_group
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_color_group extends SPFTESTIMONIAL_Fields {
24
+ /**
25
+ * Field constructor.
26
+ *
27
+ * @param array $field The field type.
28
+ * @param string $value The values of the field.
29
+ * @param string $unique The unique ID for the field.
30
+ * @param string $where To where show the output CSS.
31
+ * @param string $parent The parent args.
32
+ */
33
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
34
+ parent::__construct( $field, $value, $unique, $where, $parent );
35
+ }
36
 
37
+ /**
38
+ * Render field
39
+ *
40
+ * @return void
41
+ */
42
+ public function render() {
43
 
44
+ $options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
45
 
46
+ echo wp_kses_post( $this->field_before() );
47
 
48
+ if ( ! empty( $options ) ) {
49
+ foreach ( $options as $key => $option ) {
50
 
51
+ $color_value = ( ! empty( $this->value[ $key ] ) ) ? $this->value[ $key ] : '';
52
+ $default_attr = ( ! empty( $this->field['default'][ $key ] ) ) ? ' data-default-color="' . $this->field['default'][ $key ] . '"' : '';
53
 
54
+ echo '<div class="spftestimonial--left spftestimonial-field-color">';
55
+ echo '<div class="spftestimonial--title">' . esc_html( $option ) . '</div>';
56
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
57
+ echo '<input type="text" name="' . esc_attr( $this->field_name( '[' . $key . ']' ) ) . '" value="' . esc_attr( $color_value ) . '" class="spftestimonial-color"' . wp_kses_post( $default_attr ) . $this->field_attributes() . '/>';
58
+ echo '</div>';
59
 
60
+ }
61
+ }
62
 
63
+ echo '<div class="clear"></div>';
64
 
65
+ echo wp_kses_post( $this->field_after() );
66
 
67
+ }
68
 
69
+ }
70
  }
admin/views/framework/fields/column/column.php CHANGED
@@ -1,23 +1,49 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: column
 
6
  *
7
- * @since 2.2.0
8
- * @version 2.2.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_column' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_column extends SPFTESTIMONIAL_Fields {
12
-
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
20
- $this->field, array(
 
21
  'large_desktop_icon' => '<i class="fa fa-television"></i>',
22
  'desktop_icon' => '<i class="fa fa-desktop"></i>',
23
  'laptop_icon' => '<i class="fa fa-laptop"></i>',
@@ -28,8 +54,8 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_column' ) ) {
28
  'laptop_placeholder' => esc_html__( 'Laptop', 'testimonial-free' ),
29
  'tablet_placeholder' => esc_html__( 'Tablet', 'testimonial-free' ),
30
  'mobile_placeholder' => esc_html__( 'Mobile', 'testimonial-free' ),
31
- 'large_desktop' => true,
32
- 'desktop' => true,
33
  'laptop' => true,
34
  'tablet' => true,
35
  'mobile' => true,
@@ -46,7 +72,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_column' ) ) {
46
 
47
  $value = wp_parse_args( $this->value, $default_values );
48
 
49
- echo $this->field_before();
50
 
51
  $properties = array();
52
 
@@ -56,22 +82,22 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_column' ) ) {
56
  }
57
  }
58
 
59
- $properties = ( $properties === array( 'desktop', 'tablet' ) ) ? array_reverse( $properties ) : $properties;
60
 
61
  foreach ( $properties as $property ) {
62
 
63
  $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
64
 
65
  echo '<div class="spftestimonial--input">';
66
- echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--label-icon">' . $args[ $property . '_icon' ] . '</span>' : '';
67
- echo '<input type="number" name="' . $this->field_name( '[' . $property . ']' ) . '" value="' . $value[ $property ] . '"' . $placeholder . ' class="spftestimonial-number" />';
68
  echo '</div>';
69
 
70
  }
71
 
72
  echo '<div class="clear"></div>';
73
 
74
- echo $this->field_after();
75
 
76
  }
77
 
1
+ <?php
 
2
  /**
3
+ * Framework column field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_column' ) ) {
16
+ /**
17
+ *
18
+ * Field: column
19
+ *
20
+ * @since 2.2.0
21
+ * @version 2.2.0
22
+ */
23
  class SPFTESTIMONIAL_Field_column extends SPFTESTIMONIAL_Fields {
24
+ /**
25
+ * Field constructor.
26
+ *
27
+ * @param array $field The field type.
28
+ * @param string $value The values of the field.
29
+ * @param string $unique The unique ID for the field.
30
+ * @param string $where To where show the output CSS.
31
+ * @param string $parent The parent args.
32
+ */
33
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
34
  parent::__construct( $field, $value, $unique, $where, $parent );
35
  }
36
 
37
+ /**
38
+ * Render field
39
+ *
40
+ * @return void
41
+ */
42
  public function render() {
43
 
44
  $args = wp_parse_args(
45
+ $this->field,
46
+ array(
47
  'large_desktop_icon' => '<i class="fa fa-television"></i>',
48
  'desktop_icon' => '<i class="fa fa-desktop"></i>',
49
  'laptop_icon' => '<i class="fa fa-laptop"></i>',
54
  'laptop_placeholder' => esc_html__( 'Laptop', 'testimonial-free' ),
55
  'tablet_placeholder' => esc_html__( 'Tablet', 'testimonial-free' ),
56
  'mobile_placeholder' => esc_html__( 'Mobile', 'testimonial-free' ),
57
+ 'large_desktop' => true,
58
+ 'desktop' => true,
59
  'laptop' => true,
60
  'tablet' => true,
61
  'mobile' => true,
72
 
73
  $value = wp_parse_args( $this->value, $default_values );
74
 
75
+ echo wp_kses_post( $this->field_before() );
76
 
77
  $properties = array();
78
 
82
  }
83
  }
84
 
85
+ $properties = ( array( 'desktop', 'tablet' ) === $properties ) ? array_reverse( $properties ) : $properties;
86
 
87
  foreach ( $properties as $property ) {
88
 
89
  $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
90
 
91
  echo '<div class="spftestimonial--input">';
92
+ echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--label-icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
93
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-number" />';
94
  echo '</div>';
95
 
96
  }
97
 
98
  echo '<div class="clear"></div>';
99
 
100
+ echo wp_kses_post( $this->field_after() );
101
 
102
  }
103
 
admin/views/framework/fields/content/content.php DELETED
@@ -1,22 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: content
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_content' ) ) {
11
- class SPFTESTIMONIAL_Field_content extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
- echo $this->field['content'];
19
- }
20
-
21
- }
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/custom_import/custom_import.php CHANGED
@@ -1,27 +1,53 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: Custom_import
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_import' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_custom_import extends SPFTESTIMONIAL_Fields {
12
-
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
 
 
 
 
 
 
16
  public function render() {
17
- echo $this->field_before();
18
  $spt_testimonial = admin_url( 'edit.php?post_type=spt_testimonial' );
19
  $spt_shortcodes = admin_url( 'edit.php?post_type=spt_shortcodes' );
20
  echo '<p><input type="file" id="import" accept=".json"></p>';
21
  echo '<p><button type="button" class="import">Import</button></p>';
22
- echo '<a id="spt_shortcode_link_redirect" href="' . $spt_shortcodes . '"></a>';
23
- echo '<a id="spt_testimonial_link_redirect" href="' . $spt_testimonial . '"></a>';
24
- echo $this->field_after();
25
  }
26
  }
27
  }
1
+ <?php
 
2
  /**
3
+ * Framework Custom_import field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_import' ) ) {
16
+ /**
17
+ *
18
+ * Field: Custom_import
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_custom_import extends SPFTESTIMONIAL_Fields {
24
+ /**
25
+ * Field constructor.
26
+ *
27
+ * @param array $field The field type.
28
+ * @param string $value The values of the field.
29
+ * @param string $unique The unique ID for the field.
30
+ * @param string $where To where show the output CSS.
31
+ * @param string $parent The parent args.
32
+ */
33
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
34
  parent::__construct( $field, $value, $unique, $where, $parent );
35
  }
36
+
37
+ /**
38
+ * Render field
39
+ *
40
+ * @return void
41
+ */
42
  public function render() {
43
+ echo wp_kses_post( $this->field_before() );
44
  $spt_testimonial = admin_url( 'edit.php?post_type=spt_testimonial' );
45
  $spt_shortcodes = admin_url( 'edit.php?post_type=spt_shortcodes' );
46
  echo '<p><input type="file" id="import" accept=".json"></p>';
47
  echo '<p><button type="button" class="import">Import</button></p>';
48
+ echo '<a id="spt_shortcode_link_redirect" href="' . esc_url( $spt_shortcodes ) . '"></a>';
49
+ echo '<a id="spt_testimonial_link_redirect" href="' . esc_url( $spt_testimonial ) . '"></a>';
50
+ echo wp_kses_post( $this->field_after() );
51
  }
52
  }
53
  }
admin/views/framework/fields/custom_size/custom_size.php CHANGED
@@ -1,47 +1,72 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: Dimension Advanced.
 
6
  *
7
- * @since 2.2.0
8
- * @version 2.2.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_size' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_custom_size extends SPFTESTIMONIAL_Fields {
12
-
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
20
  $this->field,
21
  array(
22
- 'width_icon' => '<i class="fa fa-arrows-h"></i>',
23
- 'height_icon' => '<i class="fa fa-arrows-v"></i>',
24
- 'width_placeholder' => esc_html__( 'width', 'testimonial-free' ),
25
- 'height_placeholder' => esc_html__( 'height', 'testimonial-free' ),
26
- 'width' => true,
27
- 'height' => true,
28
- 'crop' => true,
29
- 'crops' => array( 'soft-crop', 'hard-crop' ),
30
  'unit' => 'px',
31
  )
32
  );
33
 
34
  $default_value = array(
35
- 'width' => '',
36
- 'height' => '',
37
- 'crop' => 'hard-crop',
38
  );
39
 
40
  $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
41
 
42
  $value = wp_parse_args( $this->value, $default_value );
43
 
44
- echo $this->field_before();
45
 
46
  $properties = array();
47
 
@@ -51,26 +76,26 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_size' ) ) {
51
  }
52
  }
53
 
54
- $properties = ( $properties === array( 'width', 'height' ) ) ? array_reverse( $properties ) : $properties;
55
 
56
  foreach ( $properties as $property ) {
57
 
58
  $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
59
 
60
  echo '<div class="spftestimonial--input">';
61
- echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--label-icon">' . $args[ $property . '_icon' ] . '</span>' : '';
62
- echo '<input type="number" name="' . $this->field_name( '[' . $property . ']' ) . '" value="' . $value[ $property ] . '"' . $placeholder . ' class="spftestimonial-number" />';
63
- echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--label-unit">' . $args['unit'] . '</span>' : '';
64
  echo '</div>';
65
 
66
  }
67
 
68
  if ( ! empty( $args['crop'] ) ) {
69
  echo '<div class="spf--left spf--input">';
70
- echo '<select name="' . $this->field_name( '[crop]' ) . '">';
71
  foreach ( $args['crops'] as $crop_prop ) {
72
  $selected = ( $value['crop'] === $crop_prop ) ? ' selected' : '';
73
- echo '<option value="' . $crop_prop . '"' . $selected . '>' . $crop_prop . '</option>';
74
  }
75
  echo '</select>';
76
  echo '</div>';
@@ -78,7 +103,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_size' ) ) {
78
 
79
  echo '<div class="clear"></div>';
80
 
81
- echo $this->field_after();
82
 
83
  }
84
 
1
+ <?php
 
2
  /**
3
+ * Framework custom_size field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_custom_size' ) ) {
16
+ /**
17
+ *
18
+ * Field: Dimension Advanced.
19
+ *
20
+ * @since 2.2.0
21
+ * @version 2.2.0
22
+ */
23
  class SPFTESTIMONIAL_Field_custom_size extends SPFTESTIMONIAL_Fields {
24
+ /**
25
+ * Field constructor.
26
+ *
27
+ * @param array $field The field type.
28
+ * @param string $value The values of the field.
29
+ * @param string $unique The unique ID for the field.
30
+ * @param string $where To where show the output CSS.
31
+ * @param string $parent The parent args.
32
+ */
33
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
34
  parent::__construct( $field, $value, $unique, $where, $parent );
35
  }
36
 
37
+ /**
38
+ * Render field
39
+ *
40
+ * @return void
41
+ */
42
  public function render() {
43
 
44
  $args = wp_parse_args(
45
  $this->field,
46
  array(
47
+ 'width_icon' => '<i class="fa fa-arrows-h"></i>',
48
+ 'height_icon' => '<i class="fa fa-arrows-v"></i>',
49
+ 'width_placeholder' => esc_html__( 'width', 'testimonial-free' ),
50
+ 'height_placeholder' => esc_html__( 'height', 'testimonial-free' ),
51
+ 'width' => true,
52
+ 'height' => true,
53
+ 'crop' => true,
54
+ 'crops' => array( 'soft-crop', 'hard-crop' ),
55
  'unit' => 'px',
56
  )
57
  );
58
 
59
  $default_value = array(
60
+ 'width' => '',
61
+ 'height' => '',
62
+ 'crop' => 'hard-crop',
63
  );
64
 
65
  $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
66
 
67
  $value = wp_parse_args( $this->value, $default_value );
68
 
69
+ echo wp_kses_post( $this->field_before() );
70
 
71
  $properties = array();
72
 
76
  }
77
  }
78
 
79
+ $properties = ( array( 'width', 'height' ) === $properties ) ? array_reverse( $properties ) : $properties;
80
 
81
  foreach ( $properties as $property ) {
82
 
83
  $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
84
 
85
  echo '<div class="spftestimonial--input">';
86
+ echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--label-icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
87
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-number" />';
88
+ echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--label spftestimonial--label-unit">' . esc_html( $args['unit'] ) . '</span>' : '';
89
  echo '</div>';
90
 
91
  }
92
 
93
  if ( ! empty( $args['crop'] ) ) {
94
  echo '<div class="spf--left spf--input">';
95
+ echo '<select name="' . esc_attr( $this->field_name( '[crop]' ) ) . '">';
96
  foreach ( $args['crops'] as $crop_prop ) {
97
  $selected = ( $value['crop'] === $crop_prop ) ? ' selected' : '';
98
+ echo '<option value="' . esc_attr( $crop_prop ) . '"' . esc_attr( $selected ) . '>' . esc_html( $crop_prop ) . '</option>';
99
  }
100
  echo '</select>';
101
  echo '</div>';
103
 
104
  echo '<div class="clear"></div>';
105
 
106
+ echo wp_kses_post( $this->field_after() );
107
 
108
  }
109
 
admin/views/framework/fields/date/date.php DELETED
@@ -1,64 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: date
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_date' ) ) {
11
- class SPFTESTIMONIAL_Field_date extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $default_settings = array(
20
- 'dateFormat' => 'mm/dd/yy',
21
- );
22
-
23
- $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
24
- $settings = wp_parse_args( $settings, $default_settings );
25
-
26
- echo $this->field_before();
27
-
28
- if( ! empty( $this->field['from_to'] ) ) {
29
-
30
- $args = wp_parse_args( $this->field, array(
31
- 'text_from' => esc_html__( 'From', 'testimonial-free' ),
32
- 'text_to' => esc_html__( 'To', 'testimonial-free' ),
33
- ) );
34
-
35
- $value = wp_parse_args( $this->value, array(
36
- 'from' => '',
37
- 'to' => '',
38
- ) );
39
-
40
- echo '<label class="spftestimonial--from">'. $args['text_from'] .' <input type="text" name="'. $this->field_name('[from]') .'" value="'. $value['from'] .'"'. $this->field_attributes() .'/></label>';
41
- echo '<label class="spftestimonial--to">'. $args['text_to'] .' <input type="text" name="'. $this->field_name('[to]') .'" value="'. $value['to'] .'"'. $this->field_attributes() .'/></label>';
42
-
43
- } else {
44
-
45
- echo '<input type="text" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes() .'/>';
46
-
47
- }
48
-
49
- echo '<div class="spftestimonial-date-settings" data-settings="'. esc_attr( json_encode( $settings ) ) .'"></div>';
50
-
51
- echo $this->field_after();
52
-
53
- }
54
-
55
- public function enqueue() {
56
-
57
- if( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
58
- wp_enqueue_script( 'jquery-ui-datepicker' );
59
- }
60
-
61
- }
62
-
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/dimensions/dimensions.php DELETED
@@ -1,101 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: dimensions
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_dimensions' ) ) {
11
- class SPFTESTIMONIAL_Field_dimensions extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'width_icon' => '<i class="fa fa-arrows-h"></i>',
21
- 'height_icon' => '<i class="fa fa-arrows-v"></i>',
22
- 'width_placeholder' => esc_html__( 'width', 'testimonial-free' ),
23
- 'height_placeholder' => esc_html__( 'height', 'testimonial-free' ),
24
- 'width' => true,
25
- 'height' => true,
26
- 'unit' => true,
27
- 'show_units' => true,
28
- 'units' => array( 'px', '%', 'em' )
29
- ) );
30
-
31
- $default_values = array(
32
- 'width' => '',
33
- 'height' => '',
34
- 'unit' => 'px',
35
- );
36
-
37
- $value = wp_parse_args( $this->value, $default_values );
38
- $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
39
- $is_unit = ( ! empty( $unit ) ) ? ' spftestimonial--is-unit' : '';
40
-
41
- echo $this->field_before();
42
-
43
- echo '<div class="spftestimonial--inputs">';
44
-
45
- if( ! empty( $args['width'] ) ) {
46
- $placeholder = ( ! empty( $args['width_placeholder'] ) ) ? ' placeholder="'. $args['width_placeholder'] .'"' : '';
47
- echo '<div class="spftestimonial--input">';
48
- echo ( ! empty( $args['width_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args['width_icon'] .'</span>' : '';
49
- echo '<input type="number" name="'. $this->field_name('[width]') .'" value="'. $value['width'] .'"'. $placeholder .' class="spftestimonial-input-number'. $is_unit .'" />';
50
- echo ( ! empty( $unit ) ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['units'][0] .'</span>' : '';
51
- echo '</div>';
52
- }
53
-
54
- if( ! empty( $args['height'] ) ) {
55
- $placeholder = ( ! empty( $args['height_placeholder'] ) ) ? ' placeholder="'. $args['height_placeholder'] .'"' : '';
56
- echo '<div class="spftestimonial--input">';
57
- echo ( ! empty( $args['height_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args['height_icon'] .'</span>' : '';
58
- echo '<input type="number" name="'. $this->field_name('[height]') .'" value="'. $value['height'] .'"'. $placeholder .' class="spftestimonial-input-number'. $is_unit .'" />';
59
- echo ( ! empty( $unit ) ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['units'][0] .'</span>' : '';
60
- echo '</div>';
61
- }
62
-
63
- if( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) {
64
- echo '<div class="spftestimonial--input">';
65
- echo '<select name="'. $this->field_name('[unit]') .'">';
66
- foreach( $args['units'] as $unit ) {
67
- $selected = ( $value['unit'] === $unit ) ? ' selected' : '';
68
- echo '<option value="'. $unit .'"'. $selected .'>'. $unit .'</option>';
69
- }
70
- echo '</select>';
71
- echo '</div>';
72
- }
73
-
74
- echo '</div>';
75
-
76
- echo $this->field_after();
77
-
78
- }
79
-
80
- public function output() {
81
-
82
- $output = '';
83
- $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
84
- $prefix = ( ! empty( $this->field['output_prefix'] ) ) ? $this->field['output_prefix'] .'-' : '';
85
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
86
- $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
87
- $width = ( isset( $this->value['width'] ) && $this->value['width'] !== '' ) ? $prefix .'width:'. $this->value['width'] . $unit . $important .';' : '';
88
- $height = ( isset( $this->value['height'] ) && $this->value['width'] !== '' ) ? $prefix .'height:'. $this->value['height'] . $unit . $important .';' : '';
89
-
90
- if( $width !== '' || $height !== '' ) {
91
- $output = $element .'{'. $width . $height .'}';
92
- }
93
-
94
- $this->parent->output_css .= $output;
95
-
96
- return $output;
97
-
98
- }
99
-
100
- }
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/fieldset/fieldset.php DELETED
@@ -1,41 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: fieldset
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_fieldset' ) ) {
11
- class SPFTESTIMONIAL_Field_fieldset extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- echo $this->field_before();
20
-
21
- echo '<div class="spftestimonial-fieldset-content">';
22
-
23
- foreach ( $this->field['fields'] as $field ) {
24
-
25
- $field_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
26
- $field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
27
- $field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default;
28
- $unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
29
-
30
- SPFTESTIMONIAL::field( $field, $field_value, $unique_id, 'field/fieldset' );
31
-
32
- }
33
-
34
- echo '</div>';
35
-
36
- echo $this->field_after();
37
-
38
- }
39
-
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/form_upper_section/form_upper_section.php CHANGED
@@ -1,21 +1,47 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Field: form_upper_section
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_form_upper_section' ) ) {
 
 
 
 
 
 
 
12
  class SPFTESTIMONIAL_Field_form_upper_section extends SPFTESTIMONIAL_Fields {
13
 
14
-
 
 
 
 
 
 
 
 
15
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
  parent::__construct( $field, $value, $unique, $where, $parent );
18
  }
 
 
 
 
 
 
19
  public function render() { ?>
20
  <div class="sp-tfree-help sp-tfree-upgrade tfree-upper-box-area">
21
  <div class="sp-tfree-pro-features">
1
+ <?php
 
 
2
  /**
3
+ * Framework form_upper_section field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_form_upper_section' ) ) {
17
+ /**
18
+ *
19
+ * Field: form_upper_section
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
  class SPFTESTIMONIAL_Field_form_upper_section extends SPFTESTIMONIAL_Fields {
25
 
26
+ /**
27
+ * Field constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
36
 
37
  parent::__construct( $field, $value, $unique, $where, $parent );
38
  }
39
+
40
+ /**
41
+ * Render field
42
+ *
43
+ * @return void
44
+ */
45
  public function render() { ?>
46
  <div class="sp-tfree-help sp-tfree-upgrade tfree-upper-box-area">
47
  <div class="sp-tfree-pro-features">
admin/views/framework/fields/gallery/gallery.php DELETED
@@ -1,53 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: gallery
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_gallery' ) ) {
11
- class SPFTESTIMONIAL_Field_gallery extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'add_title' => esc_html__( 'Add Gallery', 'testimonial-free' ),
21
- 'edit_title' => esc_html__( 'Edit Gallery', 'testimonial-free' ),
22
- 'clear_title' => esc_html__( 'Clear', 'testimonial-free' ),
23
- ) );
24
-
25
- $hidden = ( empty( $this->value ) ) ? ' hidden' : '';
26
-
27
- echo $this->field_before();
28
-
29
- echo '<ul>';
30
-
31
- if( ! empty( $this->value ) ) {
32
-
33
- $values = explode( ',', $this->value );
34
-
35
- foreach ( $values as $id ) {
36
- $attachment = wp_get_attachment_image_src( $id, 'thumbnail' );
37
- echo '<li><img src="'. $attachment[0] .'" /></li>';
38
- }
39
-
40
- }
41
-
42
- echo '</ul>';
43
- echo '<a href="#" class="button button-primary spftestimonial-button">'. $args['add_title'] .'</a>';
44
- echo '<a href="#" class="button spftestimonial-edit-gallery'. $hidden .'">'. $args['edit_title'] .'</a>';
45
- echo '<a href="#" class="button spftestimonial-warning-primary spftestimonial-clear-gallery'. $hidden .'">'. $args['clear_title'] .'</a>';
46
- echo '<input type="text" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes() .'/>';
47
-
48
- echo $this->field_after();
49
-
50
- }
51
-
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/group/group.php DELETED
@@ -1,145 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: group
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_group' ) ) {
11
- class SPFTESTIMONIAL_Field_group extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'max' => 0,
21
- 'min' => 0,
22
- 'fields' => array(),
23
- 'button_title' => esc_html__( 'Add New', 'testimonial-free' ),
24
- 'accordion_title_prefix' => '',
25
- 'accordion_title_number' => false,
26
- 'accordion_title_auto' => true,
27
- ) );
28
-
29
- $title_prefix = ( ! empty( $args['accordion_title_prefix'] ) ) ? $args['accordion_title_prefix'] : '';
30
- $title_number = ( ! empty( $args['accordion_title_number'] ) ) ? true : false;
31
- $title_auto = ( ! empty( $args['accordion_title_auto'] ) ) ? true : false;
32
-
33
- if( ! empty( $this->parent ) && preg_match( '/'. preg_quote( '['. $this->field['id'] .']' ) .'/', $this->parent ) ) {
34
-
35
- echo '<div class="spftestimonial-notice spftestimonial-notice-danger">'. esc_html__( 'Error: Nested field id can not be same with another nested field id.', 'testimonial-free' ) .'</div>';
36
-
37
- } else {
38
-
39
- echo $this->field_before();
40
-
41
- echo '<div class="spftestimonial-cloneable-item spftestimonial-cloneable-hidden">';
42
-
43
- echo '<div class="spftestimonial-cloneable-helper">';
44
- echo '<i class="spftestimonial-cloneable-sort fa fa-arrows"></i>';
45
- echo '<i class="spftestimonial-cloneable-clone fa fa-clone"></i>';
46
- echo '<i class="spftestimonial-cloneable-remove spftestimonial-confirm fa fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) .'"></i>';
47
- echo '</div>';
48
-
49
- echo '<h4 class="spftestimonial-cloneable-title">';
50
- echo '<span class="spftestimonial-cloneable-text">';
51
- echo ( $title_number ) ? '<span class="spftestimonial-cloneable-title-number"></span>' : '';
52
- echo ( $title_prefix ) ? '<span class="spftestimonial-cloneable-title-prefix">'. $title_prefix .'</span>' : '';
53
- echo ( $title_auto ) ? '<span class="spftestimonial-cloneable-value"><span class="spftestimonial-cloneable-placeholder"></span></span>' : '';
54
- echo '</span>';
55
- echo '</h4>';
56
-
57
- echo '<div class="spftestimonial-cloneable-content">';
58
- foreach ( $this->field['fields'] as $field ) {
59
-
60
- $field_parent = $this->parent .'['. $this->field['id'] .']';
61
- $field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
62
-
63
- SPFTESTIMONIAL::field( $field, $field_default, '_nonce', 'field/group', $field_parent );
64
-
65
- }
66
- echo '</div>';
67
-
68
- echo '</div>';
69
-
70
- echo '<div class="spftestimonial-cloneable-wrapper spftestimonial-data-wrapper" data-title-number="'. $title_number .'" data-unique-id="'. $this->unique .'" data-field-id="['. $this->field['id'] .']" data-max="'. $args['max'] .'" data-min="'. $args['min'] .'">';
71
-
72
- if( ! empty( $this->value ) ) {
73
-
74
- $num = 0;
75
-
76
- foreach ( $this->value as $value ) {
77
-
78
- $first_id = ( isset( $this->field['fields'][0]['id'] ) ) ? $this->field['fields'][0]['id'] : '';
79
- $first_value = ( isset( $value[$first_id] ) ) ? $value[$first_id] : '';
80
-
81
- echo '<div class="spftestimonial-cloneable-item">';
82
-
83
- echo '<div class="spftestimonial-cloneable-helper">';
84
- echo '<i class="spftestimonial-cloneable-sort fa fa-arrows"></i>';
85
- echo '<i class="spftestimonial-cloneable-clone fa fa-clone"></i>';
86
- echo '<i class="spftestimonial-cloneable-remove spftestimonial-confirm fa fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) .'"></i>';
87
- echo '</div>';
88
-
89
- echo '<h4 class="spftestimonial-cloneable-title">';
90
- echo '<span class="spftestimonial-cloneable-text">';
91
- echo ( $title_number ) ? '<span class="spftestimonial-cloneable-title-number">'. ( $num+1 ) .'.</span>' : '';
92
- echo ( $title_prefix ) ? '<span class="spftestimonial-cloneable-title-prefix">'. $title_prefix .'</span>' : '';
93
- echo ( $title_auto ) ? '<span class="spftestimonial-cloneable-value">' . $first_value .'</span>' : '';
94
- echo '</span>';
95
- echo '</h4>';
96
-
97
- echo '<div class="spftestimonial-cloneable-content">';
98
-
99
- foreach ( $this->field['fields'] as $field ) {
100
-
101
- $field_parent = $this->parent .'['. $this->field['id'] .']';
102
- $field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']['. $num .']' : $this->field['id'] .'['. $num .']';
103
- $field_value = ( isset( $field['id'] ) && isset( $value[$field['id']] ) ) ? $value[$field['id']] : '';
104
-
105
- SPFTESTIMONIAL::field( $field, $field_value, $field_unique, 'field/group', $field_parent );
106
-
107
- }
108
-
109
- echo '</div>';
110
-
111
- echo '</div>';
112
-
113
- $num++;
114
-
115
- }
116
-
117
- }
118
-
119
- echo '</div>';
120
-
121
- echo '<div class="spftestimonial-cloneable-alert spftestimonial-cloneable-max">'. esc_html__( 'You can not add more than', 'testimonial-free' ) .' '. $args['max'] .'</div>';
122
- echo '<div class="spftestimonial-cloneable-alert spftestimonial-cloneable-min">'. esc_html__( 'You can not remove less than', 'testimonial-free' ) .' '. $args['min'] .'</div>';
123
-
124
- echo '<a href="#" class="button button-primary spftestimonial-cloneable-add">'. $args['button_title'] .'</a>';
125
-
126
- echo $this->field_after();
127
-
128
- }
129
-
130
- }
131
-
132
- public function enqueue() {
133
-
134
- if( ! wp_script_is( 'jquery-ui-accordion' ) ) {
135
- wp_enqueue_script( 'jquery-ui-accordion' );
136
- }
137
-
138
- if( ! wp_script_is( 'jquery-ui-sortable' ) ) {
139
- wp_enqueue_script( 'jquery-ui-sortable' );
140
- }
141
-
142
- }
143
-
144
- }
145
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/heading/heading.php DELETED
@@ -1,24 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: heading
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_heading' ) ) {
11
- class SPFTESTIMONIAL_Field_heading extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- echo ( ! empty( $this->field['content'] ) ) ? $this->field['content'] : '';
20
-
21
- }
22
-
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/icon_select/icon_select.php CHANGED
@@ -1,19 +1,45 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: icon_select
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_icon_select' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_icon_select extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
@@ -26,11 +52,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_icon_select' ) ) {
26
 
27
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
28
 
29
- echo $this->field_before();
30
 
31
  if ( ! empty( $args['options'] ) ) {
32
 
33
- echo '<div class="spftestimonial-siblings spftestimonial--image-group" data-multiple="' . $args['multiple'] . '">';
34
 
35
  $num = 1;
36
 
@@ -38,17 +64,17 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_icon_select' ) ) {
38
 
39
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
40
  $extra = ( $args['multiple'] ) ? '[]' : '';
41
- $active = ( in_array( $key, $value ) ) ? ' spftestimonial--active' : '';
42
- $checked = ( in_array( $key, $value ) ) ? ' checked' : '';
43
- $pro_only_class = ( isset( $option['pro_only'] ) && $option['pro_only'] == true ) ? ' spftestimonial-pro-only' : '';
44
- echo '<div class="spftestimonial--sibling spftestimonial--image sp-field-icon-select' . $active . $pro_only_class . '">';
45
  if ( isset( $option['icon'] ) && ! empty( $option['icon'] ) ) {
46
- echo '<span class="' . $option['icon'] . '"/></span>';
47
  } else {
48
- echo '<span class="' . $option . '"/></span>';
49
  }
50
- // echo '<img src="' . $option . '" alt="img-' . $num++ . '" />';
51
- echo '<input type="' . $type . '" name="' . $this->field_name( $extra ) . '" value="' . $key . '"' . $this->field_attributes() . $checked . '/>';
52
  echo '</div>';
53
 
54
  }
@@ -59,7 +85,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_icon_select' ) ) {
59
 
60
  echo '<div class="clear"></div>';
61
 
62
- echo $this->field_after();
63
 
64
  }
65
 
1
+ <?php
 
2
  /**
3
+ * Framework icon_select field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_icon_select' ) ) {
16
+ /**
17
+ *
18
+ * Field: icon_select
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_icon_select extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
  parent::__construct( $field, $value, $unique, $where, $parent );
36
  }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
  public function render() {
44
 
45
  $args = wp_parse_args(
52
 
53
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
54
 
55
+ echo wp_kses_post( $this->field_before() );
56
 
57
  if ( ! empty( $args['options'] ) ) {
58
 
59
+ echo '<div class="spftestimonial-siblings spftestimonial--image-group" data-multiple="' . esc_attr( $args['multiple'] ) . '">';
60
 
61
  $num = 1;
62
 
64
 
65
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
66
  $extra = ( $args['multiple'] ) ? '[]' : '';
67
+ $active = ( in_array( $key, $value, true ) ) ? ' spftestimonial--active' : '';
68
+ $checked = ( in_array( $key, $value, true ) ) ? ' checked' : '';
69
+ $pro_only_class = ( isset( $option['pro_only'] ) && true === $option['pro_only'] ) ? ' spftestimonial-pro-only' : '';
70
+ echo '<div class="spftestimonial--sibling spftestimonial--image sp-field-icon-select' . esc_attr( $active . $pro_only_class ) . '">';
71
  if ( isset( $option['icon'] ) && ! empty( $option['icon'] ) ) {
72
+ echo '<span class="' . esc_attr( $option['icon'] ) . '"/></span>';
73
  } else {
74
+ echo '<span class="' . esc_attr( $option ) . '"/></span>';
75
  }
76
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
77
+ echo '<input type="' . esc_attr( $type ) . '" name="' . esc_attr( $this->field_name( $extra ) ) . '" value="' . esc_attr( $key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/>';
78
  echo '</div>';
79
 
80
  }
85
 
86
  echo '<div class="clear"></div>';
87
 
88
+ echo wp_kses_post( $this->field_after() );
89
 
90
  }
91
 
admin/views/framework/fields/image_select/image_select.php CHANGED
@@ -1,19 +1,45 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: image_select
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_select' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_image_select extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
@@ -26,11 +52,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_select' ) ) {
26
 
27
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
28
 
29
- echo $this->field_before();
30
 
31
  if ( ! empty( $args['options'] ) ) {
32
 
33
- echo '<div class="spftestimonial-siblings spftestimonial--image-group" data-multiple="' . $args['multiple'] . '">';
34
 
35
  $num = 1;
36
 
@@ -38,16 +64,17 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_select' ) ) {
38
 
39
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
40
  $extra = ( $args['multiple'] ) ? '[]' : '';
41
- $active = ( in_array( $key, $value ) ) ? ' spftestimonial--active' : '';
42
- $checked = ( in_array( $key, $value ) ) ? ' checked' : '';
43
  $opt_class = isset( $option['class'] ) && ! empty( $option['class'] ) ? $option['class'] : '';
44
 
45
- echo '<div class="spftestimonial--sibling spftestimonial--image' . $active . ' ' . $opt_class . '">';
46
- echo '<img src="' . $option['image'] . '" alt="img-' . $num++ . '" />';
47
  if ( isset( $option['name'] ) ) {
48
- echo '<p>' . $option['name'] . '</p>';
49
  }
50
- echo '<input type="' . $type . '" name="' . $this->field_name( $extra ) . '" value="' . $key . '"' . $this->field_attributes() . $checked . '/>';
 
51
  echo '</div>';
52
 
53
  }
@@ -58,7 +85,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_select' ) ) {
58
 
59
  echo '<div class="clear"></div>';
60
 
61
- echo $this->field_after();
62
 
63
  }
64
 
1
+ <?php
 
2
  /**
3
+ * Framework image_select field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_select' ) ) {
16
+ /**
17
+ *
18
+ * Field: image_select
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_image_select extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
  parent::__construct( $field, $value, $unique, $where, $parent );
36
  }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
  public function render() {
44
 
45
  $args = wp_parse_args(
52
 
53
  $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
54
 
55
+ echo wp_kses_post( $this->field_before() );
56
 
57
  if ( ! empty( $args['options'] ) ) {
58
 
59
+ echo '<div class="spftestimonial-siblings spftestimonial--image-group" data-multiple="' . esc_attr( $args['multiple'] ) . '">';
60
 
61
  $num = 1;
62
 
64
 
65
  $type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
66
  $extra = ( $args['multiple'] ) ? '[]' : '';
67
+ $active = ( in_array( $key, $value, true ) ) ? ' spftestimonial--active' : '';
68
+ $checked = ( in_array( $key, $value, true ) ) ? ' checked' : '';
69
  $opt_class = isset( $option['class'] ) && ! empty( $option['class'] ) ? $option['class'] : '';
70
 
71
+ echo '<div class="spftestimonial--sibling spftestimonial--image' . esc_attr( $active . ' ' . $opt_class ) . '">';
72
+ echo '<img src="' . esc_url( $option['image'] ) . '" alt="img-' . esc_attr( $num++ ) . '" />';
73
  if ( isset( $option['name'] ) ) {
74
+ echo '<p>' . esc_html( $option['name'] ) . '</p>';
75
  }
76
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
77
+ echo '<input type="' . esc_attr( $type ) . '" name="' . esc_attr( $this->field_name( $extra ) ) . '" value="' . esc_attr( $key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/>';
78
  echo '</div>';
79
 
80
  }
85
 
86
  echo '<div class="clear"></div>';
87
 
88
+ echo wp_kses_post( $this->field_after() );
89
 
90
  }
91
 
admin/views/framework/fields/image_sizes/image_sizes.php CHANGED
@@ -1,19 +1,45 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access pages directly.
3
  /**
 
4
  *
5
- * Field: image_sizes
 
6
  *
7
- * @since 2.2.0
8
- * @version 2.2.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_image_sizes extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
@@ -27,14 +53,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
27
 
28
  $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
29
 
30
- echo $this->field_before();
31
 
32
  // Get the image sizes.
33
- global $_wp_additional_image_sizes;
34
- $sizes = array();
35
 
36
  foreach ( get_intermediate_image_sizes() as $_size ) {
37
- if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
38
 
39
  $width = get_option( "{$_size}_size_w" );
40
  $height = get_option( "{$_size}_size_h" );
@@ -68,13 +94,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
68
 
69
  if ( ! empty( $sizes ) ) {
70
 
71
- echo '<select name="' . $this->field_name( $multiple_name ) . '"' . $multiple_attr . $chosen_attr . $placeholder_attr . $this->field_attributes() . '>';
 
72
 
73
  if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
74
  if ( ! empty( $args['chosen'] ) ) {
75
  echo '<option value=""></option>';
76
  } else {
77
- echo '<option value="">' . $args['placeholder'] . '</option>';
78
  }
79
  }
80
 
@@ -82,18 +109,18 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
82
 
83
  if ( is_array( $option ) && ! empty( $option ) ) {
84
 
85
- echo '<optgroup label="' . $option_key . '">';
86
 
87
  foreach ( $option as $sub_key => $sub_value ) {
88
- $selected = ( in_array( $sub_key, $this->value ) ) ? ' selected' : '';
89
- echo '<option value="' . $sub_key . '" ' . $selected . '>' . $sub_value . '</option>';
90
  }
91
 
92
  echo '</optgroup>';
93
 
94
  } else {
95
- $selected = ( in_array( $option_key, $this->value ) ) ? ' selected' : '';
96
- echo '<option value="' . $option_key . '" ' . $selected . '>' . $option . '</option>';
97
  }
98
  }
99
 
@@ -101,14 +128,15 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
101
 
102
  } else {
103
 
 
104
  echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No image sizes found.', 'testimonial-free' );
105
 
106
  }
107
  }
108
 
109
- echo $this->field_after();
110
 
111
  }
112
 
113
  }
114
- }
1
+ <?php
 
2
  /**
3
+ * Framework image_sizes field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access pages directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_image_sizes' ) ) {
16
+ /**
17
+ *
18
+ * Field: image_sizes
19
+ *
20
+ * @since 2.2.0
21
+ * @version 2.2.0
22
+ */
23
  class SPFTESTIMONIAL_Field_image_sizes extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
  parent::__construct( $field, $value, $unique, $where, $parent );
36
  }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
  public function render() {
44
 
45
  $args = wp_parse_args(
53
 
54
  $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
55
 
56
+ echo wp_kses_post( $this->field_before() );
57
 
58
  // Get the image sizes.
59
+ global $_wp_additional_image_sizes;
60
+ $sizes = array();
61
 
62
  foreach ( get_intermediate_image_sizes() as $_size ) {
63
+ if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
64
 
65
  $width = get_option( "{$_size}_size_w" );
66
  $height = get_option( "{$_size}_size_h" );
94
 
95
  if ( ! empty( $sizes ) ) {
96
 
97
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
98
+ echo '<select name="' . esc_attr( $this->field_name( $multiple_name ) ) . '"' . wp_kses_post( $multiple_attr . $chosen_attr . $placeholder_attr ) . $this->field_attributes() . '>';
99
 
100
  if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
101
  if ( ! empty( $args['chosen'] ) ) {
102
  echo '<option value=""></option>';
103
  } else {
104
+ echo '<option value="">' . esc_html( $args['placeholder'] ) . '</option>';
105
  }
106
  }
107
 
109
 
110
  if ( is_array( $option ) && ! empty( $option ) ) {
111
 
112
+ echo '<optgroup label="' . esc_attr( $option_key ) . '">';
113
 
114
  foreach ( $option as $sub_key => $sub_value ) {
115
+ $selected = ( in_array( $sub_key, $this->value, true ) ) ? ' selected' : '';
116
+ echo '<option value="' . esc_attr( $sub_key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $sub_value ) . '</option>';
117
  }
118
 
119
  echo '</optgroup>';
120
 
121
  } else {
122
+ $selected = ( in_array( $option_key, $this->value, true ) ) ? ' selected' : '';
123
+ echo '<option value="' . esc_attr( $option_key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $option ) . '</option>';
124
  }
125
  }
126
 
128
 
129
  } else {
130
 
131
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
132
  echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No image sizes found.', 'testimonial-free' );
133
 
134
  }
135
  }
136
 
137
+ echo wp_kses_post( $this->field_after() );
138
 
139
  }
140
 
141
  }
142
+ }
admin/views/framework/fields/link_color/link_color.php DELETED
@@ -1,91 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: link_color
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_link_color' ) ) {
11
- class SPFTESTIMONIAL_Field_link_color extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'color' => true,
21
- 'hover' => true,
22
- 'active' => false,
23
- 'visited' => false,
24
- 'focus' => false,
25
- ) );
26
-
27
- $default_values = array(
28
- 'color' => '',
29
- 'hover' => '',
30
- 'active' => '',
31
- 'visited' => '',
32
- 'focus' => '',
33
- );
34
-
35
- $color_props = array(
36
- 'color' => esc_html__( 'Normal', 'testimonial-free' ),
37
- 'hover' => esc_html__( 'Hover', 'testimonial-free' ),
38
- 'active' => esc_html__( 'Active', 'testimonial-free' ),
39
- 'visited' => esc_html__( 'Visited', 'testimonial-free' ),
40
- 'focus' => esc_html__( 'Focus', 'testimonial-free' )
41
- );
42
-
43
- $value = wp_parse_args( $this->value, $default_values );
44
-
45
- echo $this->field_before();
46
-
47
- foreach ( $color_props as $color_prop_key => $color_prop_value ) {
48
-
49
- if( ! empty( $args[$color_prop_key] ) ) {
50
-
51
- $default_attr = ( ! empty( $this->field['default'][$color_prop_key] ) ) ? ' data-default-color="'. $this->field['default'][$color_prop_key] .'"' : '';
52
-
53
- echo '<div class="spftestimonial--left spftestimonial-field-color">';
54
- echo '<div class="spftestimonial--title">'. $color_prop_value .'</div>';
55
- echo '<input type="text" name="'. $this->field_name('['. $color_prop_key .']') .'" value="'. $value[$color_prop_key] .'" class="spftestimonial-color"'. $default_attr . $this->field_attributes() .'/>';
56
- echo '</div>';
57
-
58
- }
59
-
60
- }
61
-
62
- echo $this->field_after();
63
-
64
- }
65
-
66
- public function output() {
67
-
68
- $output = '';
69
- $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
70
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
71
-
72
- if( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
73
- foreach( $elements as $element ) {
74
-
75
- if( isset( $this->value['color'] ) && $this->value['color'] !== '' ) { $output .= $element .'{color:'. $this->value['color'] . $important .';}'; }
76
- if( isset( $this->value['hover'] ) && $this->value['hover'] !== '' ) { $output .= $element .':hover{color:'. $this->value['hover'] . $important .';}'; }
77
- if( isset( $this->value['active'] ) && $this->value['active'] !== '' ) { $output .= $element .':active{color:'. $this->value['active'] . $important .';}'; }
78
- if( isset( $this->value['visited'] ) && $this->value['visited'] !== '' ) { $output .= $element .':visited{color:'. $this->value['visited'] . $important .';}'; }
79
- if( isset( $this->value['focus'] ) && $this->value['focus'] !== '' ) { $output .= $element .':focus{color:'. $this->value['focus'] . $important .';}'; }
80
-
81
- }
82
- }
83
-
84
- $this->parent->output_css .= $output;
85
-
86
- return $output;
87
-
88
- }
89
-
90
- }
91
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/map/map.php DELETED
@@ -1,99 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: map
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_map' ) ) {
11
- class SPFTESTIMONIAL_Field_map extends SPFTESTIMONIAL_Fields {
12
-
13
- public $version = '1.5.1';
14
- public $cdn_url = 'https://cdn.jsdelivr.net/npm/leaflet@';
15
-
16
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
17
- parent::__construct( $field, $value, $unique, $where, $parent );
18
- }
19
-
20
- public function render() {
21
-
22
- $args = wp_parse_args( $this->field, array(
23
- 'placeholder' => esc_html__( 'Search your address...', 'testimonial-free' ),
24
- 'latitude_text' => esc_html__( 'Latitude', 'testimonial-free' ),
25
- 'longitude_text' => esc_html__( 'Longitude', 'testimonial-free' ),
26
- 'address_field' => '',
27
- 'height' => '',
28
- ) );
29
-
30
- $value = wp_parse_args( $this->value, array(
31
- 'address' => '',
32
- 'latitude' => '20',
33
- 'longitude' => '0',
34
- 'zoom' => '2',
35
- ) );
36
-
37
- $default_settings = array(
38
- 'center' => array( $value['latitude'], $value['longitude'] ),
39
- 'zoom' => $value['zoom'],
40
- 'scrollWheelZoom' => false,
41
- );
42
-
43
- $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
44
- $settings = wp_parse_args( $settings, $default_settings );
45
- $encoded = htmlspecialchars( json_encode( $settings ) );
46
-
47
- $style_attr = ( ! empty( $args['height'] ) ) ? ' style="min-height:'. $args['height'] .';"' : '';
48
- $placeholder = ( ! empty( $args['placeholder'] ) ) ? array( 'placeholder' => $args['placeholder'] ) : '';
49
-
50
- echo $this->field_before();
51
-
52
- if( empty( $args['address_field'] ) ) {
53
- echo '<div class="spftestimonial--map-search">';
54
- echo '<input type="text" name="'. $this->field_name('[address]') .'" value="'. $value['address'] .'"'. $this->field_attributes( $placeholder ) .' />';
55
- echo '</div>';
56
- } else {
57
- echo '<div class="spftestimonial--address-field" data-address-field="'. $args['address_field'] .'"></div>';
58
- }
59
-
60
- echo '<div class="spftestimonial--map-osm-wrap"><div class="spftestimonial--map-osm" data-map="'. $encoded .'"'. $style_attr .'></div></div>';
61
-
62
- echo '<div class="spftestimonial--map-inputs">';
63
-
64
- echo '<div class="spftestimonial--map-input">';
65
- echo '<label>'. $args['latitude_text'] .'</label>';
66
- echo '<input type="text" name="'. $this->field_name('[latitude]') .'" value="'. $value['latitude'] .'" class="spftestimonial--latitude" />';
67
- echo '</div>';
68
-
69
- echo '<div class="spftestimonial--map-input">';
70
- echo '<label>'. $args['longitude_text'] .'</label>';
71
- echo '<input type="text" name="'. $this->field_name('[longitude]') .'" value="'. $value['longitude'] .'" class="spftestimonial--longitude" />';
72
- echo '</div>';
73
-
74
- echo '</div>';
75
-
76
- echo '<input type="hidden" name="'. $this->field_name('[zoom]') .'" value="'. $value['zoom'] .'" class="spftestimonial--zoom" />';
77
-
78
- echo $this->field_after();
79
-
80
- }
81
-
82
- public function enqueue() {
83
-
84
- if( ! wp_script_is( 'spftestimonial-leaflet' ) ) {
85
- wp_enqueue_script( 'spftestimonial-leaflet', $this->cdn_url . $this->version .'/dist/leaflet.js', array( 'spftestimonial' ), $this->version, true );
86
- }
87
-
88
- if( ! wp_style_is( 'spftestimonial-leaflet' ) ) {
89
- wp_enqueue_style( 'spftestimonial-leaflet', $this->cdn_url . $this->version .'/dist/leaflet.css', array(), $this->version );
90
- }
91
-
92
- if( ! wp_script_is( 'jquery-ui-autocomplete' ) ) {
93
- wp_enqueue_script( 'jquery-ui-autocomplete' );
94
- }
95
-
96
- }
97
-
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/media/media.php DELETED
@@ -1,86 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: media
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_media' ) ) {
11
- class SPFTESTIMONIAL_Field_media extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'url' => true,
21
- 'preview' => true,
22
- 'library' => array(),
23
- 'button_title' => esc_html__( 'Upload', 'testimonial-free' ),
24
- 'remove_title' => esc_html__( 'Remove', 'testimonial-free' ),
25
- 'preview_size' => 'thumbnail',
26
- ) );
27
-
28
- $default_values = array(
29
- 'url' => '',
30
- 'id' => '',
31
- 'width' => '',
32
- 'height' => '',
33
- 'thumbnail' => '',
34
- 'alt' => '',
35
- 'title' => '',
36
- 'description' => ''
37
- );
38
-
39
- // fallback
40
- if( is_numeric( $this->value ) ) {
41
-
42
- $this->value = array(
43
- 'id' => $this->value,
44
- 'url' => wp_get_attachment_url( $this->value ),
45
- 'thumbnail' => wp_get_attachment_image_src( $this->value, 'thumbnail', true )[0],
46
- );
47
-
48
- }
49
-
50
- $this->value = wp_parse_args( $this->value, $default_values );
51
-
52
- $library = ( is_array( $args['library'] ) ) ? $args['library'] : array_filter( (array) $args['library'] );
53
- $library = ( ! empty( $library ) ) ? implode(',', $library ) : '';
54
- $preview_src = ( $args['preview_size'] !== 'thumbnail' ) ? $this->value['url'] : $this->value['thumbnail'];
55
- $hidden_url = ( empty( $args['url'] ) ) ? ' hidden' : '';
56
- $hidden_auto = ( empty( $this->value['url'] ) ) ? ' hidden' : '';
57
- $placeholder = ( empty( $this->field['placeholder'] ) ) ? ' placeholder="'. esc_html__( 'No media selected', 'testimonial-free' ) .'"' : '';
58
-
59
- echo $this->field_before();
60
-
61
- if( ! empty( $args['preview'] ) ) {
62
- echo '<div class="spftestimonial--preview'. $hidden_auto .'">';
63
- echo '<div class="spftestimonial-image-preview"><a href="#" class="spftestimonial--remove fa fa-times"></a><img src="'. $preview_src .'" class="spftestimonial--src" /></div>';
64
- echo '</div>';
65
- }
66
-
67
- echo '<div class="spftestimonial--placeholder">';
68
- echo '<input type="text" name="'. $this->field_name('[url]') .'" value="'. $this->value['url'] .'" class="spftestimonial--url'. $hidden_url .'" readonly="readonly"'. $this->field_attributes() . $placeholder .' />';
69
- echo '<a href="#" class="button button-primary spftestimonial--button" data-library="'. esc_attr( $library ) .'" data-preview-size="'. esc_attr( $args['preview_size'] ) .'">'. $args['button_title'] .'</a>';
70
- echo ( empty( $args['preview'] ) ) ? '<a href="#" class="button button-secondary spftestimonial-warning-primary spftestimonial--remove'. $hidden_auto .'">'. $args['remove_title'] .'</a>' : '';
71
- echo '</div>';
72
-
73
- echo '<input type="hidden" name="'. $this->field_name('[id]') .'" value="'. $this->value['id'] .'" class="spftestimonial--id"/>';
74
- echo '<input type="hidden" name="'. $this->field_name('[width]') .'" value="'. $this->value['width'] .'" class="spftestimonial--width"/>';
75
- echo '<input type="hidden" name="'. $this->field_name('[height]') .'" value="'. $this->value['height'] .'" class="spftestimonial--height"/>';
76
- echo '<input type="hidden" name="'. $this->field_name('[thumbnail]') .'" value="'. $this->value['thumbnail'] .'" class="spftestimonial--thumbnail"/>';
77
- echo '<input type="hidden" name="'. $this->field_name('[alt]') .'" value="'. $this->value['alt'] .'" class="spftestimonial--alt"/>';
78
- echo '<input type="hidden" name="'. $this->field_name('[title]') .'" value="'. $this->value['title'] .'" class="spftestimonial--title"/>';
79
- echo '<input type="hidden" name="'. $this->field_name('[description]') .'" value="'. $this->value['description'] .'" class="spftestimonial--description"/>';
80
-
81
- echo $this->field_after();
82
-
83
- }
84
-
85
- }
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/notice/notice.php CHANGED
@@ -1,27 +1,52 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Field: notice
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_notice' ) ) {
 
 
 
 
 
 
 
12
  class SPFTESTIMONIAL_Field_notice extends SPFTESTIMONIAL_Fields {
13
 
14
-
 
 
 
 
 
 
 
 
15
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
  parent::__construct( $field, $value, $unique, $where, $parent );
18
  }
19
 
 
 
 
 
 
20
  public function render() {
21
 
22
  $style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
23
 
24
- echo ( ! empty( $this->field['content'] ) ) ? '<div class="spftestimonial-notice spftestimonial-notice-' . $style . '">' . $this->field['content'] . '</div>' : '';
25
 
26
  }
27
 
1
+ <?php
 
 
2
  /**
3
+ * Framework notice field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_notice' ) ) {
17
+ /**
18
+ *
19
+ * Field: notice
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
  class SPFTESTIMONIAL_Field_notice extends SPFTESTIMONIAL_Fields {
25
 
26
+ /**
27
+ * Field constructor.
28
+ *
29
+ * @param array $field The field type.
30
+ * @param string $value The values of the field.
31
+ * @param string $unique The unique ID for the field.
32
+ * @param string $where To where show the output CSS.
33
+ * @param string $parent The parent args.
34
+ */
35
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
36
 
37
  parent::__construct( $field, $value, $unique, $where, $parent );
38
  }
39
 
40
+ /**
41
+ * Render field
42
+ *
43
+ * @return void
44
+ */
45
  public function render() {
46
 
47
  $style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
48
 
49
+ echo ( ! empty( $this->field['content'] ) ) ? '<div class="spftestimonial-notice spftestimonial-notice-' . esc_attr( $style ) . '">' . wp_kses_post( $this->field['content'] ) . '</div>' : '';
50
 
51
  }
52
 
admin/views/framework/fields/number/number.php DELETED
@@ -1,61 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: number
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_number' ) ) {
11
- class SPFTESTIMONIAL_Field_number extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'unit' => '',
21
- ) );
22
-
23
- echo $this->field_before();
24
- echo '<div class="spftestimonial--wrap">';
25
- echo '<input type="number" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes( array( 'class' => 'spftestimonial-input-number' ) ) .'/>';
26
- echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--unit">'. $args['unit'] .'</span>' : '';
27
- echo '</div>';
28
- echo '<div class="clear"></div>';
29
- echo $this->field_after();
30
-
31
- }
32
-
33
- public function output() {
34
-
35
- $output = '';
36
- $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
37
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
38
- $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
39
- $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
40
-
41
- if( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
42
- foreach( $elements as $key_property => $element ) {
43
- if( is_numeric( $key_property ) ) {
44
- if( $mode ) {
45
- $output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
46
- }
47
- break;
48
- } else {
49
- $output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
50
- }
51
- }
52
- }
53
-
54
- $this->parent->output_css .= $output;
55
-
56
- return $output;
57
-
58
- }
59
-
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/palette/palette.php DELETED
@@ -1,60 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: palette
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_palette' ) ) {
11
- class SPFTESTIMONIAL_Field_palette extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $palette = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
20
-
21
- echo $this->field_before();
22
-
23
- if( ! empty( $palette ) ) {
24
-
25
- echo '<div class="spftestimonial-siblings spftestimonial--palettes">';
26
-
27
- foreach ( $palette as $key => $colors ) {
28
-
29
- $active = ( $key === $this->value ) ? ' spftestimonial--active' : '';
30
- $checked = ( $key === $this->value ) ? ' checked' : '';
31
-
32
- echo '<div class="spftestimonial--sibling spftestimonial--palette'. $active .'">';
33
-
34
- if( ! empty( $colors ) ) {
35
-
36
- foreach( $colors as $color ) {
37
-
38
- echo '<span style="background-color: '. $color .';"></span>';
39
-
40
- }
41
-
42
- }
43
-
44
- echo '<input type="radio" name="'. $this->field_name() .'" value="'. $key .'"'. $this->field_attributes() . $checked .'/>';
45
- echo '</div>';
46
-
47
- }
48
-
49
- echo '</div>';
50
-
51
- }
52
-
53
- echo '<div class="clear"></div>';
54
-
55
- echo $this->field_after();
56
-
57
- }
58
-
59
- }
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/radio/radio.php CHANGED
@@ -1,76 +1,107 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: radio
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_radio' ) ) {
11
- class SPFTESTIMONIAL_Field_radio extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'inline' => false,
21
- 'query_args' => array(),
22
- ) );
23
-
24
- $inline_class = ( $args['inline'] ) ? ' class="spftestimonial--inline-list"' : '';
25
-
26
- echo $this->field_before();
27
-
28
- if( isset( $this->field['options'] ) ) {
29
-
30
- $options = $this->field['options'];
31
- $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
32
-
33
- if( is_array( $options ) && ! empty( $options ) ) {
34
-
35
- echo '<ul'. $inline_class .'>';
36
- foreach ( $options as $option_key => $option_value ) {
37
-
38
- if( is_array( $option_value ) && ! empty( $option_value ) ) {
39
-
40
- echo '<li>';
41
- echo '<ul>';
42
- echo '<li><strong>'. $option_key .'</strong></li>';
43
- foreach( $option_value as $sub_key => $sub_value ) {
44
- $checked = ( $sub_key == $this->value ) ? ' checked' : '';
45
- echo '<li><label><input type="radio" name="'. $this->field_name() .'" value="'. $sub_key .'"'. $this->field_attributes() . $checked .'/> '. $sub_value .'</label></li>';
46
- }
47
- echo '</ul>';
48
- echo '</li>';
49
-
50
- } else {
51
-
52
- $checked = ( $option_key == $this->value ) ? ' checked' : '';
53
- echo '<li><label><input type="radio" name="'. $this->field_name() .'" value="'. $option_key .'"'. $this->field_attributes() . $checked .'/> '. $option_value .'</label></li>';
54
-
55
- }
56
-
57
- }
58
- echo '</ul>';
59
-
60
- } else {
61
-
62
- echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
63
-
64
- }
65
-
66
- } else {
67
- $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
68
- echo '<label><input type="radio" name="'. $this->field_name() .'" value="1"'. $this->field_attributes() . checked( $this->value, 1, false ) .'/> '. $label .'</label>';
69
- }
70
-
71
- echo $this->field_after();
72
-
73
- }
74
 
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
1
+ <?php
2
  /**
3
+ * Framework radio field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_radio' ) ) {
16
+ /**
17
+ *
18
+ * Field: radio
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_radio extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'inline' => false,
49
+ 'query_args' => array(),
50
+ )
51
+ );
52
+
53
+ $inline_class = ( $args['inline'] ) ? ' class="spftestimonial--inline-list"' : '';
54
+
55
+ echo wp_kses_post( $this->field_before() );
56
+
57
+ if ( isset( $this->field['options'] ) ) {
58
+
59
+ $options = $this->field['options'];
60
+ $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
61
+
62
+ if ( is_array( $options ) && ! empty( $options ) ) {
63
+
64
+ echo '<ul' . wp_kses_post( $inline_class ) . '>';
65
+ foreach ( $options as $option_key => $option_value ) {
66
+
67
+ if ( is_array( $option_value ) && ! empty( $option_value ) ) {
68
+
69
+ echo '<li>';
70
+ echo '<ul>';
71
+ echo '<li><strong>' . esc_html( $option_key ) . '</strong></li>';
72
+ foreach ( $option_value as $sub_key => $sub_value ) {
73
+ $checked = ( $sub_key === $this->value ) ? ' checked' : '';
74
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
75
+ echo '<li><label><input type="radio" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $sub_key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/> ' . esc_html( $sub_value ) . '</label></li>';
76
+ }
77
+ echo '</ul>';
78
+ echo '</li>';
79
+
80
+ } else {
81
+
82
+ $checked = ( $option_key === $this->value ) ? ' checked' : '';
83
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
84
+ echo '<li><label><input type="radio" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $option_key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/> ' . esc_html( $option_value ) . '</label></li>';
85
+
86
+ }
87
+ }
88
+ echo '</ul>';
89
+
90
+ } else {
91
+
92
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
93
+ echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
94
+
95
+ }
96
+ } else {
97
+ $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
98
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
99
+ echo '<label><input type="radio" name="' . esc_attr( $this->field_name() ) . '" value="1"' . $this->field_attributes() . checked( $this->value, 1, false ) . '/> ' . esc_html( $label ) . '</label>';
100
+ }
101
+
102
+ echo wp_kses_post( $this->field_after() );
103
+
104
+ }
105
+
106
+ }
107
  }
admin/views/framework/fields/rating/rating.php CHANGED
@@ -1,28 +1,55 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: Rating
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_rating' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_rating extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
20
- $this->field, array(
 
21
  'query_args' => array(),
22
  )
23
  );
24
 
25
- echo $this->field_before();
26
 
27
  if ( isset( $this->field['options'] ) ) {
28
 
@@ -33,22 +60,25 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_rating' ) ) {
33
 
34
  echo '<div class="sp-tpro-client-rating">';
35
  foreach ( $options as $sub_key => $sub_value ) {
36
- $checked = ( $sub_key == $this->value ) ? ' checked' : '';
37
- echo '<input type="radio" name="' . $this->field_name() . '" id="' . $sub_key . '" value="' . $sub_key . '"' . $this->field_attributes() . $checked . '/><label for="' . $sub_key . '" title="' . $sub_value . '"><i class="fa fa-star"></i></label>';
 
38
  }
39
  echo '</div>';
40
 
41
  } else {
42
 
 
43
  echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
44
 
45
  }
46
  } else {
47
  $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
48
- echo '<label><input type="radio" name="' . $this->field_name() . '" value="1"' . $this->field_attributes() . checked( $this->value, 1, false ) . '/> ' . $label . '</label>';
 
49
  }
50
 
51
- echo $this->field_after();
52
 
53
  }
54
 
1
+ <?php
 
2
  /**
3
+ * Framework Rating field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_rating' ) ) {
16
+ /**
17
+ *
18
+ * Field: Rating
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_rating extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
  parent::__construct( $field, $value, $unique, $where, $parent );
36
  }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
  public function render() {
44
 
45
  $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
  'query_args' => array(),
49
  )
50
  );
51
 
52
+ echo wp_kses_post( $this->field_before() );
53
 
54
  if ( isset( $this->field['options'] ) ) {
55
 
60
 
61
  echo '<div class="sp-tpro-client-rating">';
62
  foreach ( $options as $sub_key => $sub_value ) {
63
+ $checked = ( $sub_key === $this->value ) ? ' checked' : '';
64
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
65
+ echo '<input type="radio" name="' . esc_attr( $this->field_name() ) . '" id="' . esc_attr( $sub_key ) . '" value="' . esc_attr( $sub_key ) . '"' . $this->field_attributes() . esc_attr( $checked ) . '/><label for="' . esc_attr( $sub_key ) . '" title="' . esc_attr( $sub_value ) . '"><i class="fa fa-star"></i></label>';
66
  }
67
  echo '</div>';
68
 
69
  } else {
70
 
71
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
72
  echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
73
 
74
  }
75
  } else {
76
  $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
77
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
78
+ echo '<label><input type="radio" name="' . esc_attr( $this->field_name() ) . '" value="1"' . $this->field_attributes() . checked( $this->value, 1, false ) . '/> ' . esc_html( $label ) . '</label>';
79
  }
80
 
81
+ echo wp_kses_post( $this->field_after() );
82
 
83
  }
84
 
admin/views/framework/fields/repeater/repeater.php CHANGED
@@ -1,116 +1,149 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: repeater
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_repeater' ) ) {
11
- class SPFTESTIMONIAL_Field_repeater extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- $args = wp_parse_args( $this->field, array(
20
- 'max' => 0,
21
- 'min' => 0,
22
- 'button_title' => '<i class="fa fa-plus-circle"></i>',
23
- ) );
 
24
 
25
- $fields = $this->field['fields'];
26
- $unique_id = ( ! empty( $this->unique ) ) ? $this->unique : $this->field['id'];
 
 
 
 
 
 
27
 
28
- if( $this->parent && preg_match( '/'. preg_quote( '['. $this->field['id'] .']' ) .'/', $this->parent ) ) {
 
29
 
30
- echo '<div class="spftestimonial-notice spftestimonial-notice-danger">'. esc_html__( 'Error: Nested field id can not be same with another nested field id.', 'testimonial-free' ) .'</div>';
31
 
32
- } else {
33
 
34
- echo $this->field_before();
35
 
36
- echo '<div class="spftestimonial-repeater-item spftestimonial-repeater-hidden">';
37
- echo '<div class="spftestimonial-repeater-content">';
38
- foreach ( $fields as $field ) {
39
 
40
- $field_parent = $this->parent .'['. $this->field['id'] .']';
41
- $field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
 
42
 
43
- SPFTESTIMONIAL::field( $field, $field_default, '_nonce', 'field/repeater', $field_parent );
 
44
 
45
- }
46
- echo '</div>';
47
- echo '<div class="spftestimonial-repeater-helper">';
48
- echo '<div class="spftestimonial-repeater-helper-inner">';
49
- echo '<i class="spftestimonial-repeater-sort fa fa-arrows"></i>';
50
- echo '<i class="spftestimonial-repeater-clone fa fa-clone"></i>';
51
- echo '<i class="spftestimonial-repeater-remove spftestimonial-confirm fa fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) .'"></i>';
52
- echo '</div>';
53
- echo '</div>';
54
- echo '</div>';
55
 
56
- echo '<div class="spftestimonial-repeater-wrapper spftestimonial-data-wrapper" data-unique-id="'. $this->unique .'" data-field-id="['. $this->field['id'] .']" data-max="'. $args['max'] .'" data-min="'. $args['min'] .'">';
 
 
 
 
 
 
 
 
 
57
 
58
- if( ! empty( $this->value ) ) {
59
 
60
- $num = 0;
61
 
62
- foreach ( $this->value as $key => $value ) {
63
 
64
- echo '<div class="spftestimonial-repeater-item">';
65
 
66
- echo '<div class="spftestimonial-repeater-content">';
67
- foreach ( $fields as $field ) {
68
 
69
- $field_parent = $this->parent .'['. $this->field['id'] .']';
70
- $field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']['. $num .']' : $this->field['id'] .'['. $num .']';
71
- $field_value = ( isset( $field['id'] ) && isset( $this->value[$key][$field['id']] ) ) ? $this->value[$key][$field['id']] : '';
72
 
73
- SPFTESTIMONIAL::field( $field, $field_value, $field_unique, 'field/repeater', $field_parent );
 
 
74
 
75
- }
76
- echo '</div>';
77
 
78
- echo '<div class="spftestimonial-repeater-helper">';
79
- echo '<div class="spftestimonial-repeater-helper-inner">';
80
- echo '<i class="spftestimonial-repeater-sort fa fa-arrows"></i>';
81
- echo '<i class="spftestimonial-repeater-clone fa fa-clone"></i>';
82
- echo '<i class="spftestimonial-repeater-remove spftestimonial-confirm fa fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) .'"></i>';
83
- echo '</div>';
84
- echo '</div>';
85
 
86
- echo '</div>';
 
 
 
 
 
 
87
 
88
- $num++;
89
 
90
- }
91
 
92
- }
 
93
 
94
- echo '</div>';
95
 
96
- echo '<div class="spftestimonial-repeater-alert spftestimonial-repeater-max">'. esc_html__( 'You can not add more than', 'testimonial-free' ) .' '. $args['max'] .'</div>';
97
- echo '<div class="spftestimonial-repeater-alert spftestimonial-repeater-min">'. esc_html__( 'You can not remove less than', 'testimonial-free' ) .' '. $args['min'] .'</div>';
98
 
99
- echo '<a href="#" class="button button-primary spftestimonial-repeater-add">'. $args['button_title'] .'</a>';
100
 
101
- echo $this->field_after();
102
 
103
- }
104
 
105
- }
106
 
107
- public function enqueue() {
 
 
 
 
 
108
 
109
- if( ! wp_script_is( 'jquery-ui-sortable' ) ) {
110
- wp_enqueue_script( 'jquery-ui-sortable' );
111
- }
112
 
113
- }
114
 
115
- }
116
  }
1
+ <?php
2
  /**
3
+ * Framework repeater field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_repeater' ) ) {
16
+ /**
17
+ *
18
+ * Field: repeater
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_repeater extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'max' => 0,
49
+ 'min' => 0,
50
+ 'button_title' => '<i class="fa fa-plus-circle"></i>',
51
+ )
52
+ );
53
 
54
+ $fields = $this->field['fields'];
55
+ $unique_id = ( ! empty( $this->unique ) ) ? $this->unique : $this->field['id'];
56
 
57
+ if ( $this->parent && preg_match( '/' . preg_quote( '[' . $this->field['id'] . ']' ) . '/', $this->parent ) ) {
58
 
59
+ echo '<div class="spftestimonial-notice spftestimonial-notice-danger">' . esc_html__( 'Error: Nested field id can not be same with another nested field id.', 'testimonial-free' ) . '</div>';
60
 
61
+ } else {
62
 
63
+ echo wp_kses_post( $this->field_before() );
 
 
64
 
65
+ echo '<div class="spftestimonial-repeater-item spftestimonial-repeater-hidden">';
66
+ echo '<div class="spftestimonial-repeater-content">';
67
+ foreach ( $fields as $field ) {
68
 
69
+ $field_parent = $this->parent . '[' . $this->field['id'] . ']';
70
+ $field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
71
 
72
+ SPFTESTIMONIAL::field( $field, $field_default, '_nonce', 'field/repeater', $field_parent );
 
 
 
 
 
 
 
 
 
73
 
74
+ }
75
+ echo '</div>';
76
+ echo '<div class="spftestimonial-repeater-helper">';
77
+ echo '<div class="spftestimonial-repeater-helper-inner">';
78
+ echo '<i class="spftestimonial-repeater-sort fa fa-arrows"></i>';
79
+ echo '<i class="spftestimonial-repeater-clone fa fa-clone"></i>';
80
+ echo '<i class="spftestimonial-repeater-remove spftestimonial-confirm fa fa-times" data-confirm="' . esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) . '"></i>';
81
+ echo '</div>';
82
+ echo '</div>';
83
+ echo '</div>';
84
 
85
+ echo '<div class="spftestimonial-repeater-wrapper spftestimonial-data-wrapper" data-unique-id="' . esc_attr( $this->unique ) . '" data-field-id="[' . esc_attr( $this->field['id'] ) . ']" data-max="' . esc_attr( $args['max'] ) . '" data-min="' . esc_attr( $args['min'] ) . '">';
86
 
87
+ if ( ! empty( $this->value ) ) {
88
 
89
+ $num = 0;
90
 
91
+ foreach ( $this->value as $key => $value ) {
92
 
93
+ echo '<div class="spftestimonial-repeater-item">';
 
94
 
95
+ echo '<div class="spftestimonial-repeater-content">';
96
+ foreach ( $fields as $field ) {
 
97
 
98
+ $field_parent = $this->parent . '[' . $this->field['id'] . ']';
99
+ $field_unique = ( ! empty( $this->unique ) ) ? $this->unique . '[' . $this->field['id'] . '][' . $num . ']' : $this->field['id'] . '[' . $num . ']';
100
+ $field_value = ( isset( $field['id'] ) && isset( $this->value[ $key ][ $field['id'] ] ) ) ? $this->value[ $key ][ $field['id'] ] : '';
101
 
102
+ SPFTESTIMONIAL::field( $field, $field_value, $field_unique, 'field/repeater', $field_parent );
 
103
 
104
+ }
105
+ echo '</div>';
 
 
 
 
 
106
 
107
+ echo '<div class="spftestimonial-repeater-helper">';
108
+ echo '<div class="spftestimonial-repeater-helper-inner">';
109
+ echo '<i class="spftestimonial-repeater-sort fa fa-arrows"></i>';
110
+ echo '<i class="spftestimonial-repeater-clone fa fa-clone"></i>';
111
+ echo '<i class="spftestimonial-repeater-remove spftestimonial-confirm fa fa-times" data-confirm="' . esc_html__( 'Are you sure to delete this item?', 'testimonial-free' ) . '"></i>';
112
+ echo '</div>';
113
+ echo '</div>';
114
 
115
+ echo '</div>';
116
 
117
+ $num++;
118
 
119
+ }
120
+ }
121
 
122
+ echo '</div>';
123
 
124
+ echo '<div class="spftestimonial-repeater-alert spftestimonial-repeater-max">' . esc_html__( 'You can not add more than', 'testimonial-free' ) . ' ' . esc_html( $args['max'] ) . '</div>';
125
+ echo '<div class="spftestimonial-repeater-alert spftestimonial-repeater-min">' . esc_html__( 'You can not remove less than', 'testimonial-free' ) . ' ' . esc_html( $args['min'] ) . '</div>';
126
 
127
+ echo '<a href="#" class="button button-primary spftestimonial-repeater-add">' . wp_kses_post( $args['button_title'] ) . '</a>';
128
 
129
+ echo wp_kses_post( $this->field_after() );
130
 
131
+ }
132
 
133
+ }
134
 
135
+ /**
136
+ * Enqueue function
137
+ *
138
+ * @return void
139
+ */
140
+ public function enqueue() {
141
 
142
+ if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
143
+ wp_enqueue_script( 'jquery-ui-sortable' );
144
+ }
145
 
146
+ }
147
 
148
+ }
149
  }
admin/views/framework/fields/select/select.php CHANGED
@@ -1,131 +1,166 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: select
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_select' ) ) {
11
- class SPFTESTIMONIAL_Field_select extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'placeholder' => '',
21
- 'chosen' => false,
22
- 'multiple' => false,
23
- 'sortable' => false,
24
- 'ajax' => false,
25
- 'settings' => array(),
26
- 'query_args' => array(),
27
- ) );
28
-
29
- $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
30
-
31
- echo $this->field_before();
32
-
33
- if( isset( $this->field['options'] ) ) {
34
-
35
- if( ! empty( $args['ajax'] ) ) {
36
- $args['settings']['data']['type'] = $args['options'];
37
- $args['settings']['data']['nonce'] = wp_create_nonce( 'spftestimonial_chosen_ajax_nonce' );
38
- if( ! empty( $args['query_args'] ) ) {
39
- $args['settings']['data']['query_args'] = $args['query_args'];
40
- }
41
- }
42
-
43
- $chosen_rtl = ( is_rtl() ) ? ' chosen-rtl' : '';
44
- $multiple_name = ( $args['multiple'] ) ? '[]' : '';
45
- $multiple_attr = ( $args['multiple'] ) ? ' multiple="multiple"' : '';
46
- $chosen_sortable = ( $args['chosen'] && $args['sortable'] ) ? ' spftestimonial-chosen-sortable' : '';
47
- $chosen_ajax = ( $args['chosen'] && $args['ajax'] ) ? ' spftestimonial-chosen-ajax' : '';
48
- $placeholder_attr = ( $args['chosen'] && $args['placeholder'] ) ? ' data-placeholder="'. $args['placeholder'] .'"' : '';
49
- $field_class = ( $args['chosen'] ) ? ' class="spftestimonial-chosen'. $chosen_rtl . $chosen_sortable . $chosen_ajax .'"' : '';
50
- $field_name = $this->field_name( $multiple_name );
51
- $field_attr = $this->field_attributes();
52
- $maybe_options = $this->field['options'];
53
- $chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="'. esc_attr( json_encode( $args['settings'] ) ) .'"' : '';
54
-
55
- if( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
56
- $options = $this->field_wp_query_data_title( $maybe_options, $this->value );
57
- } else if( is_string( $maybe_options ) ) {
58
- $options = $this->field_data( $maybe_options, false, $args['query_args'] );
59
- } else {
60
- $options = $maybe_options;
61
- }
62
-
63
- if( ( is_array( $options ) && ! empty( $options ) ) || ( ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) ) {
64
-
65
- if( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
66
-
67
- echo '<select name="'. $field_name .'" class="spftestimonial-hidden-select spftestimonial-hidden"'. $multiple_attr . $field_attr .'>';
68
- foreach( $this->value as $option_key ) {
69
- echo '<option value="'. $option_key .'" selected>'. $option_key .'</option>';
70
- }
71
- echo '</select>';
72
-
73
- $field_name = '_pseudo';
74
- $field_attr = '';
75
-
76
- }
77
-
78
- echo '<select name="'. $field_name .'"'. $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr .'>';
79
-
80
- if( $args['placeholder'] && empty( $args['multiple'] ) ) {
81
- if( ! empty( $args['chosen'] ) ) {
82
- echo '<option value=""></option>';
83
- } else {
84
- echo '<option value="">'. $args['placeholder'] .'</option>';
85
- }
86
- }
87
-
88
- foreach( $options as $option_key => $option ) {
89
-
90
- if( is_array( $option ) && ! empty( $option ) ) {
91
-
92
- echo '<optgroup label="'. $option_key .'">';
93
-
94
- foreach( $option as $sub_key => $sub_value ) {
95
- $selected = ( in_array( $sub_key, $this->value ) ) ? ' selected' : '';
96
- echo '<option value="'. $sub_key .'" '. $selected .'>'. $sub_value .'</option>';
97
- }
98
-
99
- echo '</optgroup>';
100
-
101
- } else {
102
- $selected = ( in_array( $option_key, $this->value ) ) ? ' selected' : '';
103
- echo '<option value="'. $option_key .'" '. $selected .'>'. $option .'</option>';
104
- }
105
-
106
- }
107
-
108
- echo '</select>';
109
-
110
- } else {
111
-
112
- echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
113
 
114
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
- }
 
117
 
118
- echo $this->field_after();
119
 
120
- }
121
 
122
- public function enqueue() {
 
 
 
 
 
123
 
124
- if( ! wp_script_is( 'jquery-ui-sortable' ) ) {
125
- wp_enqueue_script( 'jquery-ui-sortable' );
126
- }
127
 
128
- }
129
 
130
- }
131
  }
1
+ <?php
2
  /**
3
+ * Framework select field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_select' ) ) {
16
+ /**
17
+ *
18
+ * Field: select
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_select extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'placeholder' => '',
49
+ 'chosen' => false,
50
+ 'multiple' => false,
51
+ 'sortable' => false,
52
+ 'ajax' => false,
53
+ 'settings' => array(),
54
+ 'query_args' => array(),
55
+ )
56
+ );
57
+
58
+ $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
59
+
60
+ echo wp_kses_post( $this->field_before() );
61
+
62
+ if ( isset( $this->field['options'] ) ) {
63
+
64
+ if ( ! empty( $args['ajax'] ) ) {
65
+ $args['settings']['data']['type'] = $args['options'];
66
+ $args['settings']['data']['nonce'] = wp_create_nonce( 'spftestimonial_chosen_ajax_nonce' );
67
+ if ( ! empty( $args['query_args'] ) ) {
68
+ $args['settings']['data']['query_args'] = $args['query_args'];
69
+ }
70
+ }
71
+
72
+ $chosen_rtl = ( is_rtl() ) ? ' chosen-rtl' : '';
73
+ $multiple_name = ( $args['multiple'] ) ? '[]' : '';
74
+ $multiple_attr = ( $args['multiple'] ) ? ' multiple="multiple"' : '';
75
+ $chosen_sortable = ( $args['chosen'] && $args['sortable'] ) ? ' spftestimonial-chosen-sortable' : '';
76
+ $chosen_ajax = ( $args['chosen'] && $args['ajax'] ) ? ' spftestimonial-chosen-ajax' : '';
77
+ $placeholder_attr = ( $args['chosen'] && $args['placeholder'] ) ? ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '"' : '';
78
+ $field_class = ( $args['chosen'] ) ? ' class="spftestimonial-chosen' . esc_attr( $chosen_rtl . $chosen_sortable . $chosen_ajax ) . '"' : '';
79
+ $field_name = $this->field_name( $multiple_name );
80
+ $field_attr = $this->field_attributes();
81
+ $maybe_options = $this->field['options'];
82
+ $chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="' . esc_attr( wp_json_encode( $args['settings'] ) ) . '"' : '';
83
+
84
+ if ( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
85
+ $options = $this->field_wp_query_data_title( $maybe_options, $this->value );
86
+ } elseif ( is_string( $maybe_options ) ) {
87
+ $options = $this->field_data( $maybe_options, false, $args['query_args'] );
88
+ } else {
89
+ $options = $maybe_options;
90
+ }
91
+
92
+ if ( ( is_array( $options ) && ! empty( $options ) ) || ( ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) ) {
93
+
94
+ if ( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
95
+
96
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
97
+ echo '<select name="' . esc_attr( $field_name ) . '" class="spftestimonial-hidden-select spftestimonial-hidden"' . $multiple_attr . $field_attr . '>';
98
+ foreach ( $this->value as $option_key ) {
99
+ echo '<option value="' . esc_attr( $option_key ) . '" selected>' . esc_html( $option_key ) . '</option>';
100
+ }
101
+ echo '</select>';
102
+
103
+ $field_name = '_pseudo';
104
+ $field_attr = '';
105
+
106
+ }
107
+
108
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109
+ echo '<select name="' . esc_attr( $field_name ) . '"' . $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr . '>';
110
+
111
+ if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
112
+ if ( ! empty( $args['chosen'] ) ) {
113
+ echo '<option value=""></option>';
114
+ } else {
115
+ echo '<option value="">' . esc_html( $args['placeholder'] ) . '</option>';
116
+ }
117
+ }
118
+
119
+ foreach ( $options as $option_key => $option ) {
120
+
121
+ if ( is_array( $option ) && ! empty( $option ) ) {
122
+
123
+ echo '<optgroup label="' . esc_attr( $option_key ) . '">';
124
+
125
+ foreach ( $option as $sub_key => $sub_value ) {
126
+ $selected = ( in_array( $sub_key, $this->value, true ) ) ? ' selected' : '';
127
+ echo '<option value="' . esc_attr( $sub_key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $sub_value ) . '</option>';
128
+ }
129
+
130
+ echo '</optgroup>';
131
+
132
+ } else {
133
+ $selected = ( in_array( $option_key, $this->value, true ) ) ? ' selected' : '';
134
+ echo '<option value="' . esc_attr( $option_key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $option ) . '</option>';
135
+ }
136
+ }
137
+
138
+ echo '</select>';
139
+
140
+ } else {
141
+
142
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
143
+ echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
144
 
145
+ }
146
+ }
147
 
148
+ echo wp_kses_post( $this->field_after() );
149
 
150
+ }
151
 
152
+ /**
153
+ * Enqueue function
154
+ *
155
+ * @return void
156
+ */
157
+ public function enqueue() {
158
 
159
+ if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
160
+ wp_enqueue_script( 'jquery-ui-sortable' );
161
+ }
162
 
163
+ }
164
 
165
+ }
166
  }
admin/views/framework/fields/select_f/select_f.php CHANGED
@@ -1,23 +1,50 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: select
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_select_f extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
 
 
 
 
13
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
  parent::__construct( $field, $value, $unique, $where, $parent );
15
  }
16
 
 
 
 
 
 
17
  public function render() {
18
 
19
  $args = wp_parse_args(
20
- $this->field, array(
 
21
  'placeholder' => '',
22
  'chosen' => false,
23
  'multiple' => false,
@@ -30,7 +57,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
30
 
31
  $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
32
 
33
- echo $this->field_before();
34
 
35
  if ( isset( $this->field['options'] ) ) {
36
 
@@ -47,12 +74,12 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
47
  $multiple_attr = ( $args['multiple'] ) ? ' multiple="multiple"' : '';
48
  $chosen_sortable = ( $args['chosen'] && $args['sortable'] ) ? ' spftestimonial-chosen-sortable' : '';
49
  $chosen_ajax = ( $args['chosen'] && $args['ajax'] ) ? ' spftestimonial-chosen-ajax' : '';
50
- $placeholder_attr = ( $args['chosen'] && $args['placeholder'] ) ? ' data-placeholder="' . $args['placeholder'] . '"' : '';
51
- $field_class = ( $args['chosen'] ) ? ' class="spftestimonial-chosen' . $chosen_rtl . $chosen_sortable . $chosen_ajax . '"' : '';
52
  $field_name = $this->field_name( $multiple_name );
53
  $field_attr = $this->field_attributes();
54
  $maybe_options = $this->field['options'];
55
- $chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="' . esc_attr( json_encode( $args['settings'] ) ) . '"' : '';
56
 
57
  if ( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
58
  $options = $this->field_wp_query_data_title( $maybe_options, $this->value );
@@ -65,10 +92,10 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
65
  if ( ( is_array( $options ) && ! empty( $options ) ) || ! empty( $args['chosen'] ) ) {
66
 
67
  if ( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
68
-
69
- echo '<select name="' . $field_name . '" class="spftestimonial-hidden-select spftestimonial-hidden"' . $multiple_attr . $field_attr . '>';
70
  foreach ( $this->value as $option_key ) {
71
- echo '<option value="' . $option_key . '" selected>' . $option_key . '</option>';
72
  }
73
  echo '</select>';
74
 
@@ -76,34 +103,34 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
76
  $field_attr = '';
77
 
78
  }
79
-
80
- echo '<select name="' . $field_name . '"' . $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr . '>';
81
 
82
  if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
83
  if ( ! empty( $args['chosen'] ) ) {
84
  echo '<option value=""></option>';
85
  } else {
86
- echo '<option value="">' . $args['placeholder'] . '</option>';
87
  }
88
  }
89
 
90
  foreach ( $options as $option_key => $option ) {
91
  $pro_only_value = isset( $option['pro_only'] ) ? $option['pro_only'] : '';
92
- $pro_only = true == $pro_only_value ? ' disabled' : '';
93
- $selected = ( in_array( $option_key, $this->value ) ) ? ' selected' : '';
94
- echo '<option' . $pro_only . ' value="' . $option_key . '" ' . $selected . '>' . $option['name'] . '</option>';
95
  }
96
 
97
  echo '</select>';
98
 
99
  } else {
100
 
101
- echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
102
 
103
  }
104
  }
105
 
106
- echo $this->field_after();
107
 
108
  }
109
 
1
+ <?php
 
2
  /**
3
+ * Framework select_f field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_select_f' ) ) {
16
+ /**
17
+ *
18
+ * Field: select_f
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_select_f extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
  parent::__construct( $field, $value, $unique, $where, $parent );
36
  }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
  public function render() {
44
 
45
  $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
  'placeholder' => '',
49
  'chosen' => false,
50
  'multiple' => false,
57
 
58
  $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
59
 
60
+ echo wp_kses_post( $this->field_before() );
61
 
62
  if ( isset( $this->field['options'] ) ) {
63
 
74
  $multiple_attr = ( $args['multiple'] ) ? ' multiple="multiple"' : '';
75
  $chosen_sortable = ( $args['chosen'] && $args['sortable'] ) ? ' spftestimonial-chosen-sortable' : '';
76
  $chosen_ajax = ( $args['chosen'] && $args['ajax'] ) ? ' spftestimonial-chosen-ajax' : '';
77
+ $placeholder_attr = ( $args['chosen'] && $args['placeholder'] ) ? ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '"' : '';
78
+ $field_class = ( $args['chosen'] ) ? ' class="spftestimonial-chosen' . esc_attr( $chosen_rtl . $chosen_sortable . $chosen_ajax ) . '"' : '';
79
  $field_name = $this->field_name( $multiple_name );
80
  $field_attr = $this->field_attributes();
81
  $maybe_options = $this->field['options'];
82
+ $chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="' . esc_attr( wp_json_encode( $args['settings'] ) ) . '"' : '';
83
 
84
  if ( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
85
  $options = $this->field_wp_query_data_title( $maybe_options, $this->value );
92
  if ( ( is_array( $options ) && ! empty( $options ) ) || ! empty( $args['chosen'] ) ) {
93
 
94
  if ( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
95
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
96
+ echo '<select name="' . esc_attr( $field_name ) . '" class="spftestimonial-hidden-select spftestimonial-hidden"' . $multiple_attr . $field_attr . '>';
97
  foreach ( $this->value as $option_key ) {
98
+ echo '<option value="' . esc_attr( $option_key ) . '" selected>' . esc_html( $option_key ) . '</option>';
99
  }
100
  echo '</select>';
101
 
103
  $field_attr = '';
104
 
105
  }
106
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
107
+ echo '<select name="' . esc_attr( $field_name ) . '"' . $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr . '>';
108
 
109
  if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
110
  if ( ! empty( $args['chosen'] ) ) {
111
  echo '<option value=""></option>';
112
  } else {
113
+ echo '<option value="">' . esc_html( $args['placeholder'] ) . '</option>';
114
  }
115
  }
116
 
117
  foreach ( $options as $option_key => $option ) {
118
  $pro_only_value = isset( $option['pro_only'] ) ? $option['pro_only'] : '';
119
+ $pro_only = true === $pro_only_value ? ' disabled' : '';
120
+ $selected = ( in_array( $option_key, $this->value, true ) ) ? ' selected' : '';
121
+ echo '<option' . esc_html( $pro_only ) . ' value="' . esc_attr( $option_key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $option['name'] ) . '</option>';
122
  }
123
 
124
  echo '</select>';
125
 
126
  } else {
127
 
128
+ echo ! empty( $this->field['empty_message'] ) ? wp_kses_post( $this->field['empty_message'] ) : esc_html__( 'No data provided for this option type.', 'testimonial-free' );
129
 
130
  }
131
  }
132
 
133
+ echo wp_kses_post( $this->field_after() );
134
 
135
  }
136
 
admin/views/framework/fields/shortcode/shortcode.php CHANGED
@@ -1,25 +1,52 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die;
3
- } // Cannot access directly.
4
  /**
 
5
  *
6
- * Field: Shortcode
 
7
  *
8
- * @since 1.0.0
9
- * @version 1.0.0
10
  */
 
 
 
 
 
11
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_shortcode' ) ) {
12
- class SPFTESTIMONIAL_Field_shortcode extends SPFTESTIMONIAL_Fields {
13
 
 
 
 
 
 
 
 
 
14
 
 
 
 
 
 
 
 
 
 
15
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
16
 
17
  parent::__construct( $field, $value, $unique, $where, $parent );
18
  }
 
 
 
 
 
 
19
  public function render() {
20
 
21
  $post_id = get_the_ID();
22
- echo ( ! empty( $post_id ) ) ? '<div class="spftestimonial-scode-wrap-side"><p>To display your show or view, add the following shortcode into your post, custom post types, page, widget or block editor. If adding the show to your theme files, additionally include the surrounding PHP code, <a href="" target="_blank">see how</a>.‎</p><span class="spftestimonial-shortcode-selectable">[sp_testimonial_form id="' . $post_id . '"]</span></div>' : '';
23
  }
24
 
25
  }
1
+ <?php
 
 
2
  /**
3
+ * Framework Shortcode field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_shortcode' ) ) {
 
17
 
18
+ /**
19
+ *
20
+ * Field: Shortcode
21
+ *
22
+ * @since 1.0.0
23
+ * @version 1.0.0
24
+ */
25
+ class SPFTESTIMONIAL_Field_shortcode extends SPFTESTIMONIAL_Fields {
26
 
27
+ /**
28
+ * Field constructor.
29
+ *
30
+ * @param array $field The field type.
31
+ * @param string $value The values of the field.
32
+ * @param string $unique The unique ID for the field.
33
+ * @param string $where To where show the output CSS.
34
+ * @param string $parent The parent args.
35
+ */
36
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
37
 
38
  parent::__construct( $field, $value, $unique, $where, $parent );
39
  }
40
+
41
+ /**
42
+ * Render field
43
+ *
44
+ * @return void
45
+ */
46
  public function render() {
47
 
48
  $post_id = get_the_ID();
49
+ echo ( ! empty( $post_id ) ) ? '<div class="spftestimonial-scode-wrap-side"><p>To display your show or view, add the following shortcode into your post, custom post types, page, widget or block editor. If adding the show to your theme files, additionally include the surrounding PHP code, <a href="" target="_blank">see how</a>.‎</p><span class="spftestimonial-shortcode-selectable">[sp_testimonial_form id="' . esc_attr( $post_id ) . '"]</span></div>' : '';
50
  }
51
 
52
  }
admin/views/framework/fields/slider/slider.php DELETED
@@ -1,78 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: slider
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_slider' ) ) {
11
- class SPFTESTIMONIAL_Field_slider extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'max' => 100,
21
- 'min' => 0,
22
- 'step' => 1,
23
- 'unit' => '',
24
- ) );
25
-
26
- $is_unit = ( ! empty( $args['unit'] ) ) ? ' spftestimonial--is-unit' : '';
27
-
28
- echo $this->field_before();
29
-
30
- echo '<div class="spftestimonial--wrap">';
31
- echo '<div class="spftestimonial-slider-ui"></div>';
32
- echo '<div class="spftestimonial--input">';
33
- echo '<input type="number" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes( array( 'class' => 'spftestimonial-input-number'. $is_unit ) ) .' data-max="'. $args['max'] .'" data-min="'. $args['min'] .'" data-step="'. $args['step'] .'" />';
34
- echo ( ! empty( $args['unit'] ) ) ? '<span class="spftestimonial--unit">'. $args['unit'] .'</span>' : '';
35
- echo '</div>';
36
- echo '</div>';
37
-
38
- echo $this->field_after();
39
-
40
- }
41
-
42
- public function enqueue() {
43
-
44
- if( ! wp_script_is( 'jquery-ui-slider' ) ) {
45
- wp_enqueue_script( 'jquery-ui-slider' );
46
- }
47
-
48
- }
49
-
50
- public function output() {
51
-
52
- $output = '';
53
- $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
54
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
55
- $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
56
- $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
57
-
58
- if( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
59
- foreach( $elements as $key_property => $element ) {
60
- if( is_numeric( $key_property ) ) {
61
- if( $mode ) {
62
- $output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
63
- }
64
- break;
65
- } else {
66
- $output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
67
- }
68
- }
69
- }
70
-
71
- $this->parent->output_css .= $output;
72
-
73
- return $output;
74
-
75
- }
76
-
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/sortable/sortable.php CHANGED
@@ -1,81 +1,110 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: sortable
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_sortable' ) ) {
11
- class SPFTESTIMONIAL_Field_sortable extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
 
17
- public function render() {
 
 
 
 
 
 
 
 
18
 
19
- echo $this->field_before();
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- echo '<div class="spftestimonial--sortable">';
 
 
 
 
 
22
 
23
- $pre_sortby = array();
24
- $pre_fields = array();
25
 
26
- // Add array-keys to defined fields for sort by
27
- foreach( $this->field['fields'] as $key => $field ) {
28
- $pre_fields[$field['id']] = $field;
29
- }
30
 
31
- // Set sort by by saved-value or default-value
32
- if( ! empty( $this->value ) ) {
33
 
34
- foreach( $this->value as $key => $value ) {
35
- $pre_sortby[$key] = $pre_fields[$key];
36
- }
 
37
 
38
- } else {
 
39
 
40
- foreach( $pre_fields as $key => $value ) {
41
- $pre_sortby[$key] = $value;
42
- }
 
43
 
44
- }
 
 
 
45
 
46
- foreach( $pre_sortby as $key => $field ) {
47
 
48
- echo '<div class="spftestimonial--sortable-item">';
49
 
50
- echo '<div class="spftestimonial--sortable-content">';
51
 
52
- $field_default = ( isset( $this->field['default'][$key] ) ) ? $this->field['default'][$key] : '';
53
- $field_value = ( isset( $this->value[$key] ) ) ? $this->value[$key] : $field_default;
54
- $unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
55
 
56
- SPFTESTIMONIAL::field( $field, $field_value, $unique_id, 'field/sortable' );
57
 
58
- echo '</div>';
59
 
60
- echo '<div class="spftestimonial--sortable-helper"><i class="fa fa-arrows"></i></div>';
61
 
62
- echo '</div>';
63
 
64
- }
65
 
66
- echo '</div>';
67
 
68
- echo $this->field_after();
69
 
70
- }
71
 
72
- public function enqueue() {
 
 
 
 
 
73
 
74
- if( ! wp_script_is( 'jquery-ui-sortable' ) ) {
75
- wp_enqueue_script( 'jquery-ui-sortable' );
76
- }
77
 
78
- }
79
 
80
- }
81
  }
1
+ <?php
2
  /**
3
+ * Framework sortable field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
 
14
 
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_sortable' ) ) {
16
+ /**
17
+ *
18
+ * Field: sortable
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_sortable extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ echo wp_kses_post( $this->field_before() );
 
46
 
47
+ echo '<div class="spftestimonial--sortable">';
 
 
 
48
 
49
+ $pre_sortby = array();
50
+ $pre_fields = array();
51
 
52
+ // Add array-keys to defined fields for sort by.
53
+ foreach ( $this->field['fields'] as $key => $field ) {
54
+ $pre_fields[ $field['id'] ] = $field;
55
+ }
56
 
57
+ // Set sort by by saved-value or default-value.
58
+ if ( ! empty( $this->value ) ) {
59
 
60
+ foreach ( $this->value as $key => $value ) {
61
+ $pre_sortby[ $key ] = $pre_fields[ $key ];
62
+ }
63
+ } else {
64
 
65
+ foreach ( $pre_fields as $key => $value ) {
66
+ $pre_sortby[ $key ] = $value;
67
+ }
68
+ }
69
 
70
+ foreach ( $pre_sortby as $key => $field ) {
71
 
72
+ echo '<div class="spftestimonial--sortable-item">';
73
 
74
+ echo '<div class="spftestimonial--sortable-content">';
75
 
76
+ $field_default = ( isset( $this->field['default'][ $key ] ) ) ? $this->field['default'][ $key ] : '';
77
+ $field_value = ( isset( $this->value[ $key ] ) ) ? $this->value[ $key ] : $field_default;
78
+ $unique_id = ( ! empty( $this->unique ) ) ? $this->unique . '[' . $this->field['id'] . ']' : $this->field['id'];
79
 
80
+ SPFTESTIMONIAL::field( $field, $field_value, $unique_id, 'field/sortable' );
81
 
82
+ echo '</div>';
83
 
84
+ echo '<div class="spftestimonial--sortable-helper"><i class="fa fa-arrows"></i></div>';
85
 
86
+ echo '</div>';
87
 
88
+ }
89
 
90
+ echo '</div>';
91
 
92
+ echo wp_kses_post( $this->field_after() );
93
 
94
+ }
95
 
96
+ /**
97
+ * Enqueue function
98
+ *
99
+ * @return void
100
+ */
101
+ public function enqueue() {
102
 
103
+ if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
104
+ wp_enqueue_script( 'jquery-ui-sortable' );
105
+ }
106
 
107
+ }
108
 
109
+ }
110
  }
admin/views/framework/fields/sorter/sorter.php DELETED
@@ -1,75 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: sorter
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_sorter' ) ) {
11
- class SPFTESTIMONIAL_Field_sorter extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'disabled' => true,
21
- 'enabled_title' => esc_html__( 'Enabled', 'testimonial-free' ),
22
- 'disabled_title' => esc_html__( 'Disabled', 'testimonial-free' ),
23
- ) );
24
-
25
- echo $this->field_before();
26
-
27
- $this->value = ( ! empty( $this->value ) ) ? $this->value : $this->field['default'];
28
- $enabled_options = ( ! empty( $this->value['enabled'] ) ) ? $this->value['enabled'] : array();
29
- $disabled_options = ( ! empty( $this->value['disabled'] ) ) ? $this->value['disabled'] : array();
30
-
31
- echo ( $args['disabled'] ) ? '<div class="spftestimonial-modules">' : '';
32
-
33
- echo ( ! empty( $args['enabled_title'] ) ) ? '<div class="spftestimonial-sorter-title">'. $args['enabled_title'] .'</div>' : '';
34
- echo '<ul class="spftestimonial-enabled">';
35
- if( ! empty( $enabled_options ) ) {
36
- foreach( $enabled_options as $key => $value ) {
37
- echo '<li><input type="hidden" name="'. $this->field_name( '[enabled]['. $key .']' ) .'" value="'. $value .'"/><label>'. $value .'</label></li>';
38
- }
39
- }
40
- echo '</ul>';
41
-
42
- // Check for hide/show disabled section
43
- if( $args['disabled'] ) {
44
-
45
- echo '</div>';
46
-
47
- echo '<div class="spftestimonial-modules">';
48
- echo ( ! empty( $args['disabled_title'] ) ) ? '<div class="spftestimonial-sorter-title">'. $args['disabled_title'] .'</div>' : '';
49
- echo '<ul class="spftestimonial-disabled">';
50
- if( ! empty( $disabled_options ) ) {
51
- foreach( $disabled_options as $key => $value ) {
52
- echo '<li><input type="hidden" name="'. $this->field_name( '[disabled]['. $key .']' ) .'" value="'. $value .'"/><label>'. $value .'</label></li>';
53
- }
54
- }
55
- echo '</ul>';
56
- echo '</div>';
57
-
58
- }
59
-
60
- echo '<div class="clear"></div>';
61
-
62
- echo $this->field_after();
63
-
64
- }
65
-
66
- public function enqueue() {
67
-
68
- if( ! wp_script_is( 'jquery-ui-sortable' ) ) {
69
- wp_enqueue_script( 'jquery-ui-sortable' );
70
- }
71
-
72
- }
73
-
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/spacing/spacing.php CHANGED
@@ -1,150 +1,182 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: spacing
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_spacing' ) ) {
11
- class SPFTESTIMONIAL_Field_spacing extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'top_icon' => '<i class="fa fa-long-arrow-up"></i>',
21
- 'right_icon' => '<i class="fa fa-long-arrow-right"></i>',
22
- 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>',
23
- 'left_icon' => '<i class="fa fa-long-arrow-left"></i>',
24
- 'all_icon' => '<i class="fa fa-arrows"></i>',
25
- 'top_placeholder' => esc_html__( 'top', 'testimonial-free' ),
26
- 'right_placeholder' => esc_html__( 'right', 'testimonial-free' ),
27
- 'bottom_placeholder' => esc_html__( 'bottom', 'testimonial-free' ),
28
- 'left_placeholder' => esc_html__( 'left', 'testimonial-free' ),
29
- 'all_placeholder' => esc_html__( 'all', 'testimonial-free' ),
30
- 'top' => true,
31
- 'left' => true,
32
- 'bottom' => true,
33
- 'right' => true,
34
- 'unit' => true,
35
- 'show_units' => true,
36
- 'all' => false,
37
- 'units' => array( 'px', '%', 'em' )
38
- ) );
39
-
40
- $default_values = array(
41
- 'top' => '',
42
- 'right' => '',
43
- 'bottom' => '',
44
- 'left' => '',
45
- 'all' => '',
46
- 'unit' => 'px',
47
- );
48
-
49
- $value = wp_parse_args( $this->value, $default_values );
50
- $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
51
- $is_unit = ( ! empty( $unit ) ) ? ' spftestimonial--is-unit' : '';
52
-
53
- echo $this->field_before();
54
-
55
- echo '<div class="spftestimonial--inputs">';
56
-
57
- if( ! empty( $args['all'] ) ) {
58
-
59
- $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="'. $args['all_placeholder'] .'"' : '';
60
-
61
- echo '<div class="spftestimonial--input">';
62
- echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args['all_icon'] .'</span>' : '';
63
- echo '<input type="number" name="'. $this->field_name('[all]') .'" value="'. $value['all'] .'"'. $placeholder .' class="spftestimonial-input-number'. $is_unit .'" />';
64
- echo ( $unit ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['units'][0] .'</span>' : '';
65
- echo '</div>';
66
-
67
- } else {
68
-
69
- $properties = array();
70
-
71
- foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
72
- if( ! empty( $args[$prop] ) ) {
73
- $properties[] = $prop;
74
- }
75
- }
76
-
77
- $properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties;
78
-
79
- foreach( $properties as $property ) {
80
-
81
- $placeholder = ( ! empty( $args[$property.'_placeholder'] ) ) ? ' placeholder="'. $args[$property.'_placeholder'] .'"' : '';
82
-
83
- echo '<div class="spftestimonial--input">';
84
- echo ( ! empty( $args[$property.'_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">'. $args[$property.'_icon'] .'</span>' : '';
85
- echo '<input type="number" name="'. $this->field_name('['. $property .']') .'" value="'. $value[$property] .'"'. $placeholder .' class="spftestimonial-input-number'. $is_unit .'" />';
86
- echo ( $unit ) ? '<span class="spftestimonial--label spftestimonial--unit">'. $args['units'][0] .'</span>' : '';
87
- echo '</div>';
88
-
89
- }
90
-
91
- }
92
-
93
- if( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) {
94
- echo '<div class="spftestimonial--input">';
95
- echo '<select name="'. $this->field_name('[unit]') .'">';
96
- foreach( $args['units'] as $unit ) {
97
- $selected = ( $value['unit'] === $unit ) ? ' selected' : '';
98
- echo '<option value="'. $unit .'"'. $selected .'>'. $unit .'</option>';
99
- }
100
- echo '</select>';
101
- echo '</div>';
102
- }
103
-
104
- echo '</div>';
105
-
106
- echo $this->field_after();
107
-
108
- }
109
-
110
- public function output() {
111
-
112
- $output = '';
113
- $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
114
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
115
- $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
116
-
117
- $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding';
118
- $mode = ( $mode === 'relative' || $mode === 'absolute' || $mode === 'none' ) ? '' : $mode;
119
- $mode = ( ! empty( $mode ) ) ? $mode .'-' : '';
120
-
121
- if( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && $this->value['all'] !== '' ) {
122
 
123
- $output = $element .'{';
124
- $output .= $mode .'top:'. $this->value['all'] . $unit . $important .';';
125
- $output .= $mode .'right:'. $this->value['all'] . $unit . $important .';';
126
- $output .= $mode .'bottom:'. $this->value['all'] . $unit . $important .';';
127
- $output .= $mode .'left:'. $this->value['all'] . $unit . $important .';';
128
- $output .= '}';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
- } else {
 
 
 
 
 
131
 
132
- $top = ( isset( $this->value['top'] ) && $this->value['top'] !== '' ) ? $mode .'top:'. $this->value['top'] . $unit . $important .';' : '';
133
- $right = ( isset( $this->value['right'] ) && $this->value['right'] !== '' ) ? $mode .'right:'. $this->value['right'] . $unit . $important .';' : '';
134
- $bottom = ( isset( $this->value['bottom'] ) && $this->value['bottom'] !== '' ) ? $mode .'bottom:'. $this->value['bottom'] . $unit . $important .';' : '';
135
- $left = ( isset( $this->value['left'] ) && $this->value['left'] !== '' ) ? $mode .'left:'. $this->value['left'] . $unit . $important .';' : '';
136
 
137
- if( $top !== '' || $right !== '' || $bottom !== '' || $left !== '' ) {
138
- $output = $element .'{'. $top . $right . $bottom . $left .'}';
139
- }
 
140
 
141
- }
 
 
 
142
 
143
- $this->parent->output_css .= $output;
144
 
145
- return $output;
146
 
147
- }
148
 
149
- }
150
  }
1
+ <?php
2
  /**
3
+ * Framework spacing field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_spacing' ) ) {
16
+ /**
17
+ *
18
+ * Field: spacing
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_spacing extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'top_icon' => '<i class="fa fa-long-arrow-up"></i>',
49
+ 'right_icon' => '<i class="fa fa-long-arrow-right"></i>',
50
+ 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>',
51
+ 'left_icon' => '<i class="fa fa-long-arrow-left"></i>',
52
+ 'all_icon' => '<i class="fa fa-arrows"></i>',
53
+ 'top_placeholder' => esc_html__( 'top', 'testimonial-free' ),
54
+ 'right_placeholder' => esc_html__( 'right', 'testimonial-free' ),
55
+ 'bottom_placeholder' => esc_html__( 'bottom', 'testimonial-free' ),
56
+ 'left_placeholder' => esc_html__( 'left', 'testimonial-free' ),
57
+ 'all_placeholder' => esc_html__( 'all', 'testimonial-free' ),
58
+ 'top' => true,
59
+ 'left' => true,
60
+ 'bottom' => true,
61
+ 'right' => true,
62
+ 'unit' => true,
63
+ 'show_units' => true,
64
+ 'all' => false,
65
+ 'units' => array( 'px', '%', 'em' ),
66
+ )
67
+ );
68
+
69
+ $default_values = array(
70
+ 'top' => '',
71
+ 'right' => '',
72
+ 'bottom' => '',
73
+ 'left' => '',
74
+ 'all' => '',
75
+ 'unit' => 'px',
76
+ );
77
+
78
+ $value = wp_parse_args( $this->value, $default_values );
79
+ $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
80
+ $is_unit = ( ! empty( $unit ) ) ? ' spftestimonial--is-unit' : '';
81
+
82
+ echo wp_kses_post( $this->field_before() );
83
+
84
+ echo '<div class="spftestimonial--inputs">';
85
+
86
+ if ( ! empty( $args['all'] ) ) {
87
+
88
+ $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : '';
89
+
90
+ echo '<div class="spftestimonial--input">';
91
+ echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : '';
92
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[all]' ) ) . '" value="' . esc_attr( $value['all'] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-input-number' . esc_attr( $is_unit ) . '" />';
93
+ echo ( $unit ) ? '<span class="spftestimonial--label spftestimonial--unit">' . esc_html( $args['units'][0] ) . '</span>' : '';
94
+ echo '</div>';
95
+
96
+ } else {
97
+
98
+ $properties = array();
99
+
100
+ foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
101
+ if ( ! empty( $args[ $prop ] ) ) {
102
+ $properties[] = $prop;
103
+ }
104
+ }
105
+
106
+ $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties;
107
+
108
+ foreach ( $properties as $property ) {
109
+
110
+ $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
111
+
112
+ echo '<div class="spftestimonial--input">';
113
+ echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spftestimonial--label spftestimonial--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
114
+ echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder ) . ' class="spftestimonial-input-number' . esc_attr( $is_unit ) . '" />';
115
+ echo ( $unit ) ? '<span class="spftestimonial--label spftestimonial--unit">' . esc_html( $args['units'][0] ) . '</span>' : '';
116
+ echo '</div>';
117
+
118
+ }
119
+ }
120
+
121
+ if ( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) {
122
+ echo '<div class="spftestimonial--input">';
123
+ echo '<select name="' . esc_attr( $this->field_name( '[unit]' ) ) . '">';
124
+ foreach ( $args['units'] as $unit ) {
125
+ $selected = ( $value['unit'] === $unit ) ? ' selected' : '';
126
+ echo '<option value="' . esc_attr( $unit ) . '"' . esc_attr( $selected ) . '>' . esc_html( $unit ) . '</option>';
127
+ }
128
+ echo '</select>';
129
+ echo '</div>';
130
+ }
131
+
132
+ echo '</div>';
133
+
134
+ echo wp_kses_post( $this->field_after() );
135
+
136
+ }
137
+
138
+ /**
139
+ * Output function
140
+ *
141
+ * @return string
142
+ */
143
+ public function output() {
144
+
145
+ $output = '';
146
+ $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
147
+ $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
148
+ $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
149
+
150
+ $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding';
151
+ $mode = ( 'relative' === $mode || 'absolute' === $mode || 'none' === $mode ) ? '' : $mode;
152
+ $mode = ( ! empty( $mode ) ) ? $mode . '-' : '';
153
+
154
+ if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && '' !== $this->value['all'] ) {
155
 
156
+ $output = $element . '{';
157
+ $output .= $mode . 'top:' . $this->value['all'] . $unit . $important . ';';
158
+ $output .= $mode . 'right:' . $this->value['all'] . $unit . $important . ';';
159
+ $output .= $mode . 'bottom:' . $this->value['all'] . $unit . $important . ';';
160
+ $output .= $mode . 'left:' . $this->value['all'] . $unit . $important . ';';
161
+ $output .= '}';
162
 
163
+ } else {
 
 
 
164
 
165
+ $top = ( isset( $this->value['top'] ) && '' !== $this->value['top'] ) ? $mode . 'top:' . $this->value['top'] . $unit . $important . ';' : '';
166
+ $right = ( isset( $this->value['right'] ) && '' !== $this->value['right'] ) ? $mode . 'right:' . $this->value['right'] . $unit . $important . ';' : '';
167
+ $bottom = ( isset( $this->value['bottom'] ) && '' !== $this->value['bottom'] ) ? $mode . 'bottom:' . $this->value['bottom'] . $unit . $important . ';' : '';
168
+ $left = ( isset( $this->value['left'] ) && '' !== $this->value['left'] ) ? $mode . 'left:' . $this->value['left'] . $unit . $important . ';' : '';
169
 
170
+ if ( '' !== $top || '' !== $right || '' !== $bottom || '' !== $left ) {
171
+ $output = $element . '{' . $top . $right . $bottom . $left . '}';
172
+ }
173
+ }
174
 
175
+ $this->parent->output_css .= $output;
176
 
177
+ return $output;
178
 
179
+ }
180
 
181
+ }
182
  }
admin/views/framework/fields/spinner/spinner.php CHANGED
@@ -1,68 +1,108 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: spinner
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_spinner' ) ) {
11
- class SPFTESTIMONIAL_Field_spinner extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- $args = wp_parse_args( $this->field, array(
20
- 'max' => 100,
21
- 'min' => 0,
22
- 'step' => 1,
23
- 'unit' => '',
24
- ) );
 
 
 
25
 
26
- echo $this->field_before();
27
- echo '<div class="spftestimonial--spin"><input type="number" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes( array( 'class' => 'spftestimonial-input-number' ) ) .' data-max="'. $args['max'] .'" data-min="'. $args['min'] .'" data-step="'. $args['step'] .'" data-unit="'. $args['unit'] .'"/></div>';
28
- echo $this->field_after();
 
29
 
30
- }
31
 
32
- public function enqueue() {
 
 
 
 
 
33
 
34
- if( ! wp_script_is( 'jquery-ui-spinner' ) ) {
35
- wp_enqueue_script( 'jquery-ui-spinner' );
36
- }
37
 
38
- }
39
 
40
- public function output() {
 
 
 
 
 
41
 
42
- $output = '';
43
- $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
44
- $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
45
- $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
46
- $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
47
 
48
- if( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
49
- foreach( $elements as $key_property => $element ) {
50
- if( is_numeric( $key_property ) ) {
51
- if( $mode ) {
52
- $output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
53
- }
54
- break;
55
- } else {
56
- $output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
57
- }
58
- }
59
- }
60
 
61
- $this->parent->output_css .= $output;
62
 
63
- return $output;
64
 
65
- }
66
 
67
- }
68
  }
1
+ <?php
2
  /**
3
+ * Framework spinner field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_spinner' ) ) {
16
+ /**
17
+ *
18
+ * Field: spinner
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_spinner extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ $args = wp_parse_args(
46
+ $this->field,
47
+ array(
48
+ 'max' => 100,
49
+ 'min' => 0,
50
+ 'step' => 1,
51
+ 'unit' => '',
52
+ )
53
+ );
54
 
55
+ echo wp_kses_post( $this->field_before() );
56
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
57
+ echo '<div class="spftestimonial--spin"><input type="number" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . $this->field_attributes( array( 'class' => 'spftestimonial-input-number' ) ) . ' data-max="' . esc_attr( $args['max'] ) . '" data-min="' . esc_attr( $args['min'] ) . '" data-step="' . esc_attr( $args['step'] ) . '" data-unit="' . esc_attr( $args['unit'] ) . '"/></div>';
58
+ echo wp_kses_post( $this->field_after() );
59
 
60
+ }
61
 
62
+ /**
63
+ * Enqueue function
64
+ *
65
+ * @return void
66
+ */
67
+ public function enqueue() {
68
 
69
+ if ( ! wp_script_is( 'jquery-ui-spinner' ) ) {
70
+ wp_enqueue_script( 'jquery-ui-spinner' );
71
+ }
72
 
73
+ }
74
 
75
+ /**
76
+ * Output function
77
+ *
78
+ * @return string
79
+ */
80
+ public function output() {
81
 
82
+ $output = '';
83
+ $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
84
+ $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
85
+ $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
86
+ $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
87
 
88
+ if ( ! empty( $elements ) && isset( $this->value ) && '' !== $this->value ) {
89
+ foreach ( $elements as $key_property => $element ) {
90
+ if ( is_numeric( $key_property ) ) {
91
+ if ( $mode ) {
92
+ $output = implode( ',', $elements ) . '{' . $mode . ':' . $this->value . $unit . $important . ';}';
93
+ }
94
+ break;
95
+ } else {
96
+ $output .= $element . '{' . $key_property . ':' . $this->value . $unit . $important . '}';
97
+ }
98
+ }
99
+ }
100
 
101
+ $this->parent->output_css .= $output;
102
 
103
+ return $output;
104
 
105
+ }
106
 
107
+ }
108
  }
admin/views/framework/fields/subheading/subheading.php CHANGED
@@ -1,24 +1,50 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: subheading
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_subheading' ) ) {
11
- class SPFTESTIMONIAL_Field_subheading extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- echo ( ! empty( $this->field['content'] ) ) ? $this->field['content'] : '';
20
 
21
- }
22
 
23
- }
24
  }
1
+ <?php
2
  /**
3
+ * Framework subheading field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_subheading' ) ) {
16
+ /**
17
+ *
18
+ * Field: subheading
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_subheading extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ echo ( ! empty( $this->field['content'] ) ) ? wp_kses_post( $this->field['content'] ) : '';
46
 
47
+ }
48
 
49
+ }
50
  }
admin/views/framework/fields/submessage/submessage.php CHANGED
@@ -1,26 +1,52 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: submessage
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_submessage' ) ) {
11
- class SPFTESTIMONIAL_Field_submessage extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- $style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
20
 
21
- echo '<div class="spftestimonial-submessage spftestimonial-submessage-'. $style .'">'. $this->field['content'] .'</div>';
22
 
23
- }
24
 
25
- }
26
  }
1
+ <?php
2
  /**
3
+ * Framework submessage field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_submessage' ) ) {
16
+ /**
17
+ *
18
+ * Field: submessage
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_submessage extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ $style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
46
 
47
+ echo '<div class="spftestimonial-submessage spftestimonial-submessage-' . esc_attr( $style ) . '">' . wp_kses_post( $this->field['content'] ) . '</div>';
48
 
49
+ }
50
 
51
+ }
52
  }
admin/views/framework/fields/switcher/switcher.php CHANGED
@@ -1,42 +1,69 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: switcher
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_switcher' ) ) {
11
- class SPFTESTIMONIAL_Field_switcher extends SPFTESTIMONIAL_Fields {
12
 
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- public function render() {
 
 
 
 
 
18
 
19
- $active = ( ! empty( $this->value ) ) ? ' spftestimonial--active' : '';
20
- $text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'testimonial-free' );
21
- $text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'testimonial-free' );
22
- $text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: '. $this->field['text_width'] .'px;"': '';
23
 
24
- echo $this->field_before();
25
 
26
- echo '<div class="spftestimonial--switcher'. $active .'"'. $text_width .'>';
27
- echo '<span class="spftestimonial--on">'. $text_on .'</span>';
28
- echo '<span class="spftestimonial--off">'. $text_off .'</span>';
29
- echo '<span class="spftestimonial--ball"></span>';
30
- echo '<input type="text" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes() .' />';
31
- echo '</div>';
 
32
 
33
- echo ( ! empty( $this->field['label'] ) ) ? '<span class="spftestimonial--label">'. $this->field['label'] . '</span>' : '';
34
 
35
- echo '<div class="clear"></div>';
36
 
37
- echo $this->field_after();
38
 
39
- }
40
 
41
- }
42
  }
1
+ <?php
2
  /**
3
+ * Framework switcher field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_switcher' ) ) {
16
+ /**
17
+ *
18
+ * Field: switcher
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_switcher extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
 
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
 
45
+ $active = ( ! empty( $this->value ) ) ? ' spftestimonial--active' : '';
46
+ $text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'testimonial-free' );
47
+ $text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'testimonial-free' );
48
+ $text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: ' . $this->field['text_width'] . 'px;"' : '';
49
 
50
+ echo wp_kses_post( $this->field_before() );
51
 
52
+ echo '<div class="spftestimonial--switcher' . esc_attr( $active ) . '"' . wp_kses_post( $text_width ) . '>';
53
+ echo '<span class="spftestimonial--on">' . esc_html( $text_on ) . '</span>';
54
+ echo '<span class="spftestimonial--off">' . esc_html( $text_off ) . '</span>';
55
+ echo '<span class="spftestimonial--ball"></span>';
56
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
57
+ echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . $this->field_attributes() . ' />';
58
+ echo '</div>';
59
 
60
+ echo ( ! empty( $this->field['label'] ) ) ? '<span class="spftestimonial--label">' . esc_html( $this->field['label'] ) . '</span>' : '';
61
 
62
+ echo '<div class="clear"></div>';
63
 
64
+ echo wp_kses_post( $this->field_after() );
65
 
66
+ }
67
 
68
+ }
69
  }
admin/views/framework/fields/tabbed/tabbed.php DELETED
@@ -1,64 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: tabbed
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_tabbed' ) ) {
11
- class SPFTESTIMONIAL_Field_tabbed extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $unallows = array( 'tabbed' );
20
-
21
- echo $this->field_before();
22
-
23
- echo '<div class="spftestimonial-tabbed-nav">';
24
- foreach ( $this->field['tabs'] as $key => $tab ) {
25
-
26
- $tabbed_icon = ( ! empty( $tab['icon'] ) ) ? '<i class="spftestimonial--icon '. $tab['icon'] .'"></i>' : '';
27
- $tabbed_active = ( empty( $key ) ) ? ' class="spftestimonial-tabbed-active"' : '';
28
-
29
- echo '<a href="#"'. $tabbed_active .'>'. $tabbed_icon . $tab['title'] .'</a>';
30
-
31
- }
32
- echo '</div>';
33
-
34
- echo '<div class="spftestimonial-tabbed-sections">';
35
- foreach ( $this->field['tabs'] as $key => $tab ) {
36
-
37
- $tabbed_hidden = ( ! empty( $key ) ) ? ' hidden' : '';
38
-
39
- echo '<div class="spftestimonial-tabbed-section'. $tabbed_hidden .'">';
40
-
41
- foreach ( $tab['fields'] as $field ) {
42
-
43
- if( in_array( $field['type'], $unallows ) ) { $field['_notice'] = true; }
44
-
45
- $field_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
46
- $field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
47
- $field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default;
48
- $unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
49
-
50
- SPFTESTIMONIAL::field( $field, $field_value, $unique_id, 'field/tabbed' );
51
-
52
- }
53
-
54
- echo '</div>';
55
-
56
- }
57
- echo '</div>';
58
-
59
- echo $this->field_after();
60
-
61
- }
62
-
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/text/text.php CHANGED
@@ -1,30 +1,56 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Field: text
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_text' ) ) {
11
- class SPFTESTIMONIAL_Field_text extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $type = ( ! empty( $this->field['attributes']['type'] ) ) ? $this->field['attributes']['type'] : 'text';
20
-
21
- echo $this->field_before();
22
-
23
- echo '<input type="'. $type .'" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes() .' />';
24
-
25
- echo $this->field_after();
26
-
27
- }
28
 
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
1
+ <?php
2
  /**
3
+ * Framework text field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
+ if ( ! class_exists( 'SPFTESTIMONIAL_Field_text' ) ) {
16
+ /**
17
+ *
18
+ * Field: text
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
+ class SPFTESTIMONIAL_Field_text extends SPFTESTIMONIAL_Fields {
24
+
25
+ /**
26
+ * Field constructor.
27
+ *
28
+ * @param array $field The field type.
29
+ * @param string $value The values of the field.
30
+ * @param string $unique The unique ID for the field.
31
+ * @param string $where To where show the output CSS.
32
+ * @param string $parent The parent args.
33
+ */
34
+ public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
35
+ parent::__construct( $field, $value, $unique, $where, $parent );
36
+ }
37
+
38
+ /**
39
+ * Render field
40
+ *
41
+ * @return void
42
+ */
43
+ public function render() {
44
+
45
+ $type = ( ! empty( $this->field['attributes']['type'] ) ) ? $this->field['attributes']['type'] : 'text';
46
+
47
+ echo wp_kses_post( $this->field_before() );
48
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
49
+ echo '<input type="' . esc_attr( $type ) . '" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . $this->field_attributes() . ' />';
50
+
51
+ echo wp_kses_post( $this->field_after() );
52
+
53
+ }
54
+
55
+ }
56
  }
admin/views/framework/fields/text_f/text_f.php DELETED
@@ -1,28 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
- /**
4
- *
5
- * Field: text
6
- *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
- */
10
- if ( ! class_exists( 'SPFTESTIMONIAL_Field_text_f' ) ) {
11
- class SPFTESTIMONIAL_Field_text_f extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- echo $this->field_before();
20
-
21
- echo '<input type="text" disabled="" />';
22
-
23
- echo $this->field_after();
24
-
25
- }
26
-
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/textarea/textarea.php DELETED
@@ -1,25 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: textarea
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_textarea' ) ) {
11
- class SPFTESTIMONIAL_Field_textarea extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- echo $this->field_before();
20
- echo '<textarea name="'. $this->field_name() .'"'. $this->field_attributes() .'>'. $this->value .'</textarea>';
21
- echo $this->field_after();
22
-
23
- }
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/typography/google-fonts.php CHANGED
@@ -1,4 +1,15 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  if( ! function_exists( 'spftestimonial_get_google_fonts' ) ) {
4
  function spftestimonial_get_google_fonts() {
1
+ <?php
2
+ /**
3
+ * Framework google fonts file.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
13
 
14
  if( ! function_exists( 'spftestimonial_get_google_fonts' ) ) {
15
  function spftestimonial_get_google_fonts() {
admin/views/framework/fields/typography/typography.php CHANGED
@@ -1,26 +1,62 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
  /**
 
4
  *
5
- * Field: typography
 
6
  *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  */
 
 
 
 
10
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
 
 
 
 
 
 
 
11
  class SPFTESTIMONIAL_Field_typography extends SPFTESTIMONIAL_Fields {
12
 
 
 
 
 
 
13
  public $chosen = false;
14
 
 
 
 
 
 
15
  public $value = array();
16
 
 
 
 
 
 
 
 
 
 
17
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
18
  parent::__construct( $field, $value, $unique, $where, $parent );
19
  }
20
 
 
 
 
 
 
21
  public function render() {
22
 
23
- echo $this->field_before();
24
 
25
  $args = wp_parse_args(
26
  $this->field,
@@ -79,24 +115,26 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
79
  $this->chosen = $args['chosen'];
80
  $chosen_class = ( $this->chosen ) ? ' spftestimonial--chosen' : '';
81
 
82
- echo '<div class="spftestimonial--typography' . $chosen_class . '" data-unit="' . $args['unit'] . '" data-exclude="' . $args['exclude'] . '">';
83
 
84
  echo '<div class="spftestimonial--blocks spftestimonial--blocks-selects">';
85
 
86
  //
87
- // Font Family
88
  if ( ! empty( $args['font_family'] ) ) {
89
  echo '<div class="spftestimonial--block">';
90
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Family', 'testimonial-free' ) . '</div>';
 
91
  echo $this->create_select( array( $this->value['font-family'] => $this->value['font-family'] ), 'font-family', esc_html__( 'Select a font', 'testimonial-free' ) );
92
  echo '</div>';
93
  }
94
 
95
  //
96
- // Backup Font Family
97
  if ( ! empty( $args['backup_font_family'] ) ) {
98
  echo '<div class="spftestimonial--block spftestimonial--block-backup-font-family hidden">';
99
  echo '<div class="spftestimonial--title">' . esc_html__( 'Backup Font Family', 'testimonial-free' ) . '</div>';
 
100
  echo $this->create_select(
101
  apply_filters(
102
  'spftestimonial_field_typography_backup_font_family',
@@ -121,29 +159,28 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
121
  echo '</div>';
122
  }
123
 
124
- //
125
- // Font Style and Extra Style Select
126
  if ( ! empty( $args['font_weight'] ) || ! empty( $args['font_style'] ) ) {
127
 
128
- //
129
- // Font Style Select
130
  echo '<div class="spftestimonial--block spftestimonial--block-font-style hidden">';
131
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Style', 'testimonial-free' ) . '</div>';
132
  echo '<select class="spftestimonial--font-style-select" data-placeholder="Default">';
133
- echo '<option value="">' . ( ! $this->chosen ? esc_html__( 'Default', 'testimonial-free' ) : '' ) . '</option>';
134
  if ( ! empty( $this->value['font-weight'] ) || ! empty( $this->value['font-style'] ) ) {
135
- echo '<option value="' . strtolower( $this->value['font-weight'] . $this->value['font-style'] ) . '" selected></option>';
136
  }
137
  echo '</select>';
138
- echo '<input type="hidden" name="' . $this->field_name( '[font-weight]' ) . '" class="spftestimonial--font-weight" value="' . $this->value['font-weight'] . '" />';
139
- echo '<input type="hidden" name="' . $this->field_name( '[font-style]' ) . '" class="spftestimonial--font-style" value="' . $this->value['font-style'] . '" />';
140
 
141
  //
142
- // Extra Font Style Select
143
  if ( ! empty( $args['extra_styles'] ) ) {
144
  echo '<div class="spftestimonial--block-extra-styles hidden">';
145
  echo ( ! $this->chosen ) ? '<div class="spftestimonial--title">' . esc_html__( 'Load Extra Styles', 'testimonial-free' ) . '</div>' : '';
146
  $placeholder = ( $this->chosen ) ? esc_html__( 'Load Extra Styles', 'testimonial-free' ) : esc_html__( 'Default', 'testimonial-free' );
 
147
  echo $this->create_select( $this->value['extra-styles'], 'extra-styles', $placeholder, true );
148
  echo '</div>';
149
  }
@@ -152,21 +189,21 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
152
 
153
  }
154
 
155
- //
156
- // Subset
157
  if ( ! empty( $args['subset'] ) ) {
158
  echo '<div class="spftestimonial--block spftestimonial--block-subset hidden">';
159
  echo '<div class="spftestimonial--title">' . esc_html__( 'Subset', 'testimonial-free' ) . '</div>';
160
  $subset = ( is_array( $this->value['subset'] ) ) ? $this->value['subset'] : array_filter( (array) $this->value['subset'] );
 
161
  echo $this->create_select( $subset, 'subset', esc_html__( 'Default', 'testimonial-free' ), $args['multi_subset'] );
162
  echo '</div>';
163
  }
164
 
165
- //
166
- // Text Align
167
  if ( ! empty( $args['text_align'] ) ) {
168
  echo '<div class="spftestimonial--block">';
169
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Align', 'testimonial-free' ) . '</div>';
 
170
  echo $this->create_select(
171
  array(
172
  'inherit' => esc_html__( 'Inherit', 'testimonial-free' ),
@@ -182,11 +219,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
182
  echo '</div>';
183
  }
184
 
185
- //
186
- // Font Variant
187
  if ( ! empty( $args['font_variant'] ) ) {
188
  echo '<div class="spftestimonial--block">';
189
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Variant', 'testimonial-free' ) . '</div>';
 
190
  echo $this->create_select(
191
  array(
192
  'normal' => esc_html__( 'Normal', 'testimonial-free' ),
@@ -199,11 +236,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
199
  echo '</div>';
200
  }
201
 
202
- //
203
- // Text Transform
204
  if ( ! empty( $args['text_transform'] ) ) {
205
  echo '<div class="spftestimonial--block">';
206
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Transform', 'testimonial-free' ) . '</div>';
 
207
  echo $this->create_select(
208
  array(
209
  'none' => esc_html__( 'None', 'testimonial-free' ),
@@ -217,11 +254,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
217
  echo '</div>';
218
  }
219
 
220
- //
221
- // Text Decoration
222
  if ( ! empty( $args['text_decoration'] ) ) {
223
  echo '<div class="spftestimonial--block">';
224
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Decoration', 'testimonial-free' ) . '</div>';
 
225
  echo $this->create_select(
226
  array(
227
  'none' => esc_html__( 'None', 'testimonial-free' ),
@@ -243,165 +280,159 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
243
 
244
  echo '<div class="spftestimonial--blocks spftestimonial--blocks-inputs">';
245
 
246
- //
247
- // Font Size
248
  if ( ! empty( $args['font_size'] ) ) {
249
  echo '<div class="spftestimonial--block">';
250
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Size', 'testimonial-free' ) . '</div>';
251
- // echo '<div class="spftestimonial--input-wrap">';
252
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
253
- echo '<div class="spftestimonial--block"> <input type="number" name="' . $this->field_name( '[font-size]' ) . '" class="spftestimonial--font-size spftestimonial--input spftestimonial-input-number" value="' . $this->value['font-size'] . '" /></div>';
254
- echo '<span class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</span>';
255
  echo '</div>';
256
  echo '</div>';
257
  }
258
 
259
- //
260
- // Line Height
261
  if ( ! empty( $args['line_height'] ) ) {
262
  echo '<div class="spftestimonial--block">';
263
  echo '<div class="spftestimonial--title">' . esc_html__( 'Line Height', 'testimonial-free' ) . '</div>';
264
- // echo '<div class="spftestimonial--input-wrap">';
265
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
266
- echo '<div class="spftestimonial--block"> <input type="number" name="' . $this->field_name( '[line-height]' ) . '" class="spftestimonial--line-height spftestimonial--input spftestimonial-input-number" value="' . $this->value['line-height'] . '" /></div>';
267
- echo '<span class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</span>';
268
  echo '</div>';
269
  echo '</div>';
270
  }
271
 
272
- //
273
- // Letter Spacing
274
  if ( ! empty( $args['letter_spacing'] ) ) {
275
  echo '<div class="spftestimonial--block">';
276
  echo '<div class="spftestimonial--title">' . esc_html__( 'Letter Spacing', 'testimonial-free' ) . '</div>';
277
- // echo '<div class="spftestimonial--input-wrap">';
278
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
279
- echo '<div class="spftestimonial--block"> <input type="number" name="' . $this->field_name( '[letter-spacing]' ) . '" class="spftestimonial--letter-spacing spftestimonial--input spftestimonial-input-number" value="' . $this->value['letter-spacing'] . '" /></div>';
280
- echo '<span class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</span>';
281
  echo '</div>';
282
  echo '</div>';
283
  }
284
 
285
- //
286
- // Word Spacing
287
  if ( ! empty( $args['word_spacing'] ) ) {
288
  echo '<div class="spftestimonial--block">';
289
  echo '<div class="spftestimonial--title">' . esc_html__( 'Word Spacing', 'testimonial-free' ) . '</div>';
290
- // echo '<div class="spftestimonial--input-wrap">';
291
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
292
- echo '<div class="spftestimonial--block"><input type="number" name="' . $this->field_name( '[word-spacing]' ) . '" class="spftestimonial--word-spacing spftestimonial--input spftestimonial-input-number" value="' . $this->value['word-spacing'] . '" /></div>';
293
- echo '<span class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</span>';
294
  echo '</div>';
295
  echo '</div>';
296
  }
297
- //
298
- // Margin Top
299
  if ( ! empty( $args['margin_top'] ) ) {
300
  echo '<div class="spftestimonial--block">';
301
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Top', 'testimonial-free' ) . '</div>';
302
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
303
- echo '<div class="spftestimonial--block"><input type="number" name="' . $this->field_name( '[margin-top]' ) . '" class="spftestimonial--margin-top spftestimonial--input spftestimonial-number" value="' . $this->value['margin-top'] . '" /></div>';
304
- echo '<div class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</div>';
305
  echo '</div>';
306
  echo '</div>';
307
  }
308
 
309
- //
310
- // Margin Right
311
  if ( ! empty( $args['margin_right'] ) ) {
312
  echo '<div class="spftestimonial--block">';
313
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Right', 'testimonial-free' ) . '</div>';
314
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
315
- echo '<div class="spftestimonial--block"><input type="number" name="' . $this->field_name( '[margin-right]' ) . '" class="spftestimonial--margin-right spftestimonial--input spftestimonial-number" value="' . $this->value['margin-right'] . '" /></div>';
316
- echo '<div class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</div>';
317
  echo '</div>';
318
  echo '</div>';
319
  }
320
 
321
- //
322
- // Margin Bottom
323
  if ( ! empty( $args['margin_bottom'] ) ) {
324
  echo '<div class="spftestimonial--block">';
325
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Bottom', 'testimonial-free' ) . '</div>';
326
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
327
- echo '<div class="spftestimonial--block"><input type="number" name="' . $this->field_name( '[margin-bottom]' ) . '" class="spftestimonial--margin-bottom spftestimonial--input spftestimonial-number" value="' . $this->value['margin-bottom'] . '" /></div>';
328
- echo '<div class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</div>';
329
  echo '</div>';
330
  echo '</div>';
331
  }
332
 
333
- //
334
- // Margin Left
335
  if ( ! empty( $args['margin_left'] ) ) {
336
  echo '<div class="spftestimonial--block">';
337
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Left', 'testimonial-free' ) . '</div>';
338
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
339
- echo '<div class="spftestimonial--block"><input type="number" name="' . $this->field_name( '[margin-left]' ) . '" class="spftestimonial--margin-left spftestimonial--input spftestimonial-number" value="' . $this->value['margin-left'] . '" /></div>';
340
- echo '<div class="spftestimonial--block spftestimonial--unit">' . $args['unit'] . '</div>';
341
  echo '</div>';
342
  echo '</div>';
343
  }
344
  echo '</div>';
345
 
346
- //
347
- // Font Color
348
  if ( ! empty( $args['color'] ) ) {
349
- $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : '';
350
- echo '<div class="spftestimonial--block spftestimonial--block-font-color">';
351
- echo '<div class="spftestimonial--title">' . esc_html__( 'Font Color', 'testimonial-free' ) . '</div>';
352
- echo '<div class="spftestimonial-field-color">';
353
- echo '<input type="text" name="' . $this->field_name( '[color]' ) . '" class="spftestimonial-color spftestimonial--color" value="' . $this->value['color'] . '"' . $default_color_attr . ' />';
354
- echo '</div>';
355
- echo '</div>';
356
  }
357
 
358
- //
359
- // Custom style
360
  if ( ! empty( $args['custom_style'] ) ) {
361
  echo '<div class="spftestimonial--block spftestimonial--block-custom-style">';
362
  echo '<div class="spftestimonial--title">' . esc_html__( 'Custom Style', 'testimonial-free' ) . '</div>';
363
- echo '<textarea name="' . $this->field_name( '[custom-style]' ) . '" class="spftestimonial--custom-style">' . $this->value['custom-style'] . '</textarea>';
364
  echo '</div>';
365
  }
366
 
367
- //
368
- // Preview
369
- $always_preview = ( $args['preview'] !== 'always' ) ? ' hidden' : '';
370
 
371
  if ( ! empty( $args['preview'] ) ) {
372
- echo '<div class="spftestimonial--block spftestimonial--block-preview' . $always_preview . '">';
373
  echo '<div class="spftestimonial--toggle fa fa-toggle-off"></div>';
374
- echo '<div class="spftestimonial--preview">' . $args['preview_text'] . '</div>';
375
  echo '</div>';
376
  }
377
 
378
- echo '<input type="hidden" name="' . $this->field_name( '[type]' ) . '" class="spftestimonial--type" value="' . $this->value['type'] . '" />';
379
- echo '<input type="hidden" name="' . $this->field_name( '[unit]' ) . '" class="spftestimonial--unit-save" value="' . $args['unit'] . '" />';
380
 
381
  echo '</div>';
382
 
383
- echo $this->field_after();
384
 
385
  }
386
 
 
 
 
 
 
 
 
 
 
387
  public function create_select( $options, $name, $placeholder = '', $is_multiple = false ) {
388
 
389
  $multiple_name = ( $is_multiple ) ? '[]' : '';
390
  $multiple_attr = ( $is_multiple ) ? ' multiple data-multiple="true"' : '';
391
  $chosen_rtl = ( $this->chosen && is_rtl() ) ? ' chosen-rtl' : '';
392
 
393
- $output = '<select name="' . $this->field_name( '[' . $name . ']' . $multiple_name ) . '" class="spftestimonial--' . $name . $chosen_rtl . '" data-placeholder="' . $placeholder . '"' . $multiple_attr . '>';
394
  $output .= ( ! empty( $placeholder ) ) ? '<option value="">' . ( ( ! $this->chosen ) ? $placeholder : '' ) . '</option>' : '';
395
 
396
  if ( ! empty( $options ) ) {
397
  foreach ( $options as $option_key => $option_value ) {
398
  if ( $is_multiple ) {
399
- $selected = ( in_array( $option_value, $this->value[ $name ] ) ) ? ' selected' : '';
400
- $output .= '<option value="' . $option_value . '"' . $selected . '>' . $option_value . '</option>';
401
  } else {
402
  $option_key = ( is_numeric( $option_key ) ) ? $option_value : $option_key;
403
  $selected = ( $option_key === $this->value[ $name ] ) ? ' selected' : '';
404
- $output .= '<option value="' . $option_key . '"' . $selected . '>' . $option_value . '</option>';
405
  }
406
  }
407
  }
@@ -412,14 +443,17 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
412
 
413
  }
414
 
 
 
 
 
 
415
  public function enqueue() {
416
 
417
  if ( ! wp_style_is( 'spftestimonial-webfont-loader' ) ) {
418
 
419
  SPFTESTIMONIAL::include_plugin_file( 'fields/typography/google-fonts.php' );
420
 
421
- // wp_enqueue_script( 'spftestimonial-webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array( 'spftestimonial' ), '1.6.28', true );
422
-
423
  $webfonts = array();
424
 
425
  $customwebfonts = apply_filters( 'spftestimonial_field_typography_customwebfonts', array() );
@@ -504,6 +538,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
504
 
505
  }
506
 
 
 
 
 
 
507
  public function enqueue_google_fonts() {
508
 
509
  $value = $this->value;
@@ -511,7 +550,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
511
  $is_google = false;
512
 
513
  if ( ! empty( $this->value['type'] ) ) {
514
- $is_google = ( $this->value['type'] === 'google' ) ? true : false;
515
  } else {
516
  SPFTESTIMONIAL::include_plugin_file( 'fields/typography/google-fonts.php' );
517
  $is_google = ( array_key_exists( $this->value['font-family'], spftestimonial_get_google_fonts() ) ) ? true : false;
@@ -519,7 +558,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
519
 
520
  if ( $is_google ) {
521
 
522
- // set style
523
  $font_weight = ( ! empty( $value['font-weight'] ) ) ? $value['font-weight'] : '';
524
  $font_style = ( ! empty( $value['font-style'] ) ) ? $value['font-style'] : '';
525
 
@@ -528,14 +567,14 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
528
  $families['style'][ $style ] = $style;
529
  }
530
 
531
- // set extra styles
532
  if ( ! empty( $value['extra-styles'] ) ) {
533
  foreach ( $value['extra-styles'] as $extra_style ) {
534
  $families['style'][ $extra_style ] = $extra_style;
535
  }
536
  }
537
 
538
- // set subsets
539
  if ( ! empty( $value['subset'] ) ) {
540
  $value['subset'] = ( is_array( $value['subset'] ) ) ? $value['subset'] : array_filter( (array) $value['subset'] );
541
  foreach ( $value['subset'] as $subset ) {
@@ -558,6 +597,11 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
558
 
559
  }
560
 
 
 
 
 
 
561
  public function output() {
562
 
563
  $output = '';
@@ -572,7 +616,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
572
  $output .= 'font-family:"' . $font_family . '"' . $backup_family . $important . ';';
573
  }
574
 
575
- // Common font properties
576
  $properties = array(
577
  'color',
578
  'font-weight',
@@ -584,7 +628,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
584
  );
585
 
586
  foreach ( $properties as $property ) {
587
- if ( isset( $this->value[ $property ] ) && $this->value[ $property ] !== '' ) {
588
  $output .= $property . ':' . $this->value[ $property ] . $important . ';';
589
  }
590
  }
@@ -599,7 +643,7 @@ if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
599
  $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : '';
600
 
601
  foreach ( $properties as $property ) {
602
- if ( isset( $this->value[ $property ] ) && $this->value[ $property ] !== '' ) {
603
  $output .= $property . ':' . $this->value[ $property ] . $unit . $important . ';';
604
  }
605
  }
1
+ <?php
 
2
  /**
3
+ * Framework typography field file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! class_exists( 'SPFTESTIMONIAL_Field_typography' ) ) {
16
+ /**
17
+ *
18
+ * Field: typography
19
+ *
20
+ * @since 1.0.0
21
+ * @version 1.0.0
22
+ */
23
  class SPFTESTIMONIAL_Field_typography extends SPFTESTIMONIAL_Fields {
24
 
25
+ /**
26
+ * Chosen
27
+ *
28
+ * @var bool
29
+ */
30
  public $chosen = false;
31
 
32
+ /**
33
+ * Value
34
+ *
35
+ * @var array
36
+ */
37
  public $value = array();
38
 
39
+ /**
40
+ * Field constructor.
41
+ *
42
+ * @param array $field The field type.
43
+ * @param string $value The values of the field.
44
+ * @param string $unique The unique ID for the field.
45
+ * @param string $where To where show the output CSS.
46
+ * @param string $parent The parent args.
47
+ */
48
  public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
49
  parent::__construct( $field, $value, $unique, $where, $parent );
50
  }
51
 
52
+ /**
53
+ * Render field
54
+ *
55
+ * @return void
56
+ */
57
  public function render() {
58
 
59
+ echo wp_kses_post( $this->field_before() );
60
 
61
  $args = wp_parse_args(
62
  $this->field,
115
  $this->chosen = $args['chosen'];
116
  $chosen_class = ( $this->chosen ) ? ' spftestimonial--chosen' : '';
117
 
118
+ echo '<div class="spftestimonial--typography' . esc_attr( $chosen_class ) . '" data-unit="' . esc_attr( $args['unit'] ) . '" data-exclude="' . esc_attr( $args['exclude'] ) . '">';
119
 
120
  echo '<div class="spftestimonial--blocks spftestimonial--blocks-selects">';
121
 
122
  //
123
+ // Font Family.
124
  if ( ! empty( $args['font_family'] ) ) {
125
  echo '<div class="spftestimonial--block">';
126
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Family', 'testimonial-free' ) . '</div>';
127
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
128
  echo $this->create_select( array( $this->value['font-family'] => $this->value['font-family'] ), 'font-family', esc_html__( 'Select a font', 'testimonial-free' ) );
129
  echo '</div>';
130
  }
131
 
132
  //
133
+ // Backup Font Family.
134
  if ( ! empty( $args['backup_font_family'] ) ) {
135
  echo '<div class="spftestimonial--block spftestimonial--block-backup-font-family hidden">';
136
  echo '<div class="spftestimonial--title">' . esc_html__( 'Backup Font Family', 'testimonial-free' ) . '</div>';
137
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
138
  echo $this->create_select(
139
  apply_filters(
140
  'spftestimonial_field_typography_backup_font_family',
159
  echo '</div>';
160
  }
161
 
162
+ // Font Style and Extra Style Select.
 
163
  if ( ! empty( $args['font_weight'] ) || ! empty( $args['font_style'] ) ) {
164
 
165
+ // Font Style Select.
 
166
  echo '<div class="spftestimonial--block spftestimonial--block-font-style hidden">';
167
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Style', 'testimonial-free' ) . '</div>';
168
  echo '<select class="spftestimonial--font-style-select" data-placeholder="Default">';
169
+ echo wp_kses_post( '<option value="">' . ( ! $this->chosen ? esc_html__( 'Default', 'testimonial-free' ) : '' ) . '</option>' );
170
  if ( ! empty( $this->value['font-weight'] ) || ! empty( $this->value['font-style'] ) ) {
171
+ echo '<option value="' . esc_attr( strtolower( $this->value['font-weight'] . $this->value['font-style'] ) ) . '" selected></option>';
172
  }
173
  echo '</select>';
174
+ echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[font-weight]' ) ) . '" class="spftestimonial--font-weight" value="' . esc_attr( $this->value['font-weight'] ) . '" />';
175
+ echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[font-style]' ) ) . '" class="spftestimonial--font-style" value="' . esc_attr( $this->value['font-style'] ) . '" />';
176
 
177
  //
178
+ // Extra Font Style Select.
179
  if ( ! empty( $args['extra_styles'] ) ) {
180
  echo '<div class="spftestimonial--block-extra-styles hidden">';
181
  echo ( ! $this->chosen ) ? '<div class="spftestimonial--title">' . esc_html__( 'Load Extra Styles', 'testimonial-free' ) . '</div>' : '';
182
  $placeholder = ( $this->chosen ) ? esc_html__( 'Load Extra Styles', 'testimonial-free' ) : esc_html__( 'Default', 'testimonial-free' );
183
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
184
  echo $this->create_select( $this->value['extra-styles'], 'extra-styles', $placeholder, true );
185
  echo '</div>';
186
  }
189
 
190
  }
191
 
192
+ // Subset.
 
193
  if ( ! empty( $args['subset'] ) ) {
194
  echo '<div class="spftestimonial--block spftestimonial--block-subset hidden">';
195
  echo '<div class="spftestimonial--title">' . esc_html__( 'Subset', 'testimonial-free' ) . '</div>';
196
  $subset = ( is_array( $this->value['subset'] ) ) ? $this->value['subset'] : array_filter( (array) $this->value['subset'] );
197
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
198
  echo $this->create_select( $subset, 'subset', esc_html__( 'Default', 'testimonial-free' ), $args['multi_subset'] );
199
  echo '</div>';
200
  }
201
 
202
+ // Text Align.
 
203
  if ( ! empty( $args['text_align'] ) ) {
204
  echo '<div class="spftestimonial--block">';
205
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Align', 'testimonial-free' ) . '</div>';
206
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
207
  echo $this->create_select(
208
  array(
209
  'inherit' => esc_html__( 'Inherit', 'testimonial-free' ),
219
  echo '</div>';
220
  }
221
 
222
+ // Font Variant.
 
223
  if ( ! empty( $args['font_variant'] ) ) {
224
  echo '<div class="spftestimonial--block">';
225
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Variant', 'testimonial-free' ) . '</div>';
226
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
227
  echo $this->create_select(
228
  array(
229
  'normal' => esc_html__( 'Normal', 'testimonial-free' ),
236
  echo '</div>';
237
  }
238
 
239
+ // Text Transform.
 
240
  if ( ! empty( $args['text_transform'] ) ) {
241
  echo '<div class="spftestimonial--block">';
242
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Transform', 'testimonial-free' ) . '</div>';
243
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
244
  echo $this->create_select(
245
  array(
246
  'none' => esc_html__( 'None', 'testimonial-free' ),
254
  echo '</div>';
255
  }
256
 
257
+ // Text Decoration.
 
258
  if ( ! empty( $args['text_decoration'] ) ) {
259
  echo '<div class="spftestimonial--block">';
260
  echo '<div class="spftestimonial--title">' . esc_html__( 'Text Decoration', 'testimonial-free' ) . '</div>';
261
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
262
  echo $this->create_select(
263
  array(
264
  'none' => esc_html__( 'None', 'testimonial-free' ),
280
 
281
  echo '<div class="spftestimonial--blocks spftestimonial--blocks-inputs">';
282
 
283
+ // Font Size.
 
284
  if ( ! empty( $args['font_size'] ) ) {
285
  echo '<div class="spftestimonial--block">';
286
  echo '<div class="spftestimonial--title">' . esc_html__( 'Font Size', 'testimonial-free' ) . '</div>';
 
287
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
288
+ echo '<div class="spftestimonial--block"> <input type="number" name="' . esc_attr( $this->field_name( '[font-size]' ) ) . '" class="spftestimonial--font-size spftestimonial--input spftestimonial-input-number" value="' . esc_attr( $this->value['font-size'] ) . '" /></div>';
289
+ echo '<span class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>';
290
  echo '</div>';
291
  echo '</div>';
292
  }
293
 
294
+ // Line Height.
 
295
  if ( ! empty( $args['line_height'] ) ) {
296
  echo '<div class="spftestimonial--block">';
297
  echo '<div class="spftestimonial--title">' . esc_html__( 'Line Height', 'testimonial-free' ) . '</div>';
 
298
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
299
+ echo '<div class="spftestimonial--block"> <input type="number" name="' . esc_attr( $this->field_name( '[line-height]' ) ) . '" class="spftestimonial--line-height spftestimonial--input spftestimonial-input-number" value="' . esc_attr( $this->value['line-height'] ) . '" /></div>';
300
+ echo '<span class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>';
301
  echo '</div>';
302
  echo '</div>';
303
  }
304
 
305
+ // Letter Spacing.
 
306
  if ( ! empty( $args['letter_spacing'] ) ) {
307
  echo '<div class="spftestimonial--block">';
308
  echo '<div class="spftestimonial--title">' . esc_html__( 'Letter Spacing', 'testimonial-free' ) . '</div>';
 
309
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
310
+ echo '<div class="spftestimonial--block"> <input type="number" name="' . esc_attr( $this->field_name( '[letter-spacing]' ) ) . '" class="spftestimonial--letter-spacing spftestimonial--input spftestimonial-input-number" value="' . esc_attr( $this->value['letter-spacing'] ) . '" /></div>';
311
+ echo '<span class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>';
312
  echo '</div>';
313
  echo '</div>';
314
  }
315
 
316
+ // Word Spacing.
 
317
  if ( ! empty( $args['word_spacing'] ) ) {
318
  echo '<div class="spftestimonial--block">';
319
  echo '<div class="spftestimonial--title">' . esc_html__( 'Word Spacing', 'testimonial-free' ) . '</div>';
 
320
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
321
+ echo '<div class="spftestimonial--block"><input type="number" name="' . esc_attr( $this->field_name( '[word-spacing]' ) ) . '" class="spftestimonial--word-spacing spftestimonial--input spftestimonial-input-number" value="' . esc_attr( $this->value['word-spacing'] ) . '" /></div>';
322
+ echo '<span class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</span>';
323
  echo '</div>';
324
  echo '</div>';
325
  }
326
+ // Margin Top.
 
327
  if ( ! empty( $args['margin_top'] ) ) {
328
  echo '<div class="spftestimonial--block">';
329
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Top', 'testimonial-free' ) . '</div>';
330
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
331
+ echo '<div class="spftestimonial--block"><input type="number" name="' . esc_attr( $this->field_name( '[margin-top]' ) ) . '" class="spftestimonial--margin-top spftestimonial--input spftestimonial-number" value="' . esc_attr( $this->value['margin-top'] ) . '" /></div>';
332
+ echo '<div class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</div>';
333
  echo '</div>';
334
  echo '</div>';
335
  }
336
 
337
+ // Margin Right.
 
338
  if ( ! empty( $args['margin_right'] ) ) {
339
  echo '<div class="spftestimonial--block">';
340
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Right', 'testimonial-free' ) . '</div>';
341
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
342
+ echo '<div class="spftestimonial--block"><input type="number" name="' . esc_attr( $this->field_name( '[margin-right]' ) ) . '" class="spftestimonial--margin-right spftestimonial--input spftestimonial-number" value="' . esc_attr( $this->value['margin-right'] ) . '" /></div>';
343
+ echo '<div class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</div>';
344
  echo '</div>';
345
  echo '</div>';
346
  }
347
 
348
+ // Margin Bottom.
 
349
  if ( ! empty( $args['margin_bottom'] ) ) {
350
  echo '<div class="spftestimonial--block">';
351
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Bottom', 'testimonial-free' ) . '</div>';
352
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
353
+ echo '<div class="spftestimonial--block"><input type="number" name="' . esc_attr( $this->field_name( '[margin-bottom]' ) ) . '" class="spftestimonial--margin-bottom spftestimonial--input spftestimonial-number" value="' . esc_attr( $this->value['margin-bottom'] ) . '" /></div>';
354
+ echo '<div class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</div>';
355
  echo '</div>';
356
  echo '</div>';
357
  }
358
 
359
+ // Margin Left.
 
360
  if ( ! empty( $args['margin_left'] ) ) {
361
  echo '<div class="spftestimonial--block">';
362
  echo '<div class="spftestimonial--title">' . esc_html__( 'Margin Left', 'testimonial-free' ) . '</div>';
363
  echo '<div class="spftestimonial--blocks spftestimonial--input-area">';
364
+ echo '<div class="spftestimonial--block"><input type="number" name="' . esc_attr( $this->field_name( '[margin-left]' ) ) . '" class="spftestimonial--margin-left spftestimonial--input spftestimonial-number" value="' . esc_attr( $this->value['margin-left'] ) . '" /></div>';
365
+ echo '<div class="spftestimonial--block spftestimonial--unit">' . esc_html( $args['unit'] ) . '</div>';
366
  echo '</div>';
367
  echo '</div>';
368
  }
369
  echo '</div>';
370
 
371
+ // Font Color.
 
372
  if ( ! empty( $args['color'] ) ) {
373
+ $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : '';
374
+ echo '<div class="spftestimonial--block spftestimonial--block-font-color">';
375
+ echo '<div class="spftestimonial--title">' . esc_html__( 'Font Color', 'testimonial-free' ) . '</div>';
376
+ echo '<div class="spftestimonial-field-color">';
377
+ echo '<input type="text" name="' . esc_attr( $this->field_name( '[color]' ) ) . '" class="spftestimonial-color spftestimonial--color" value="' . esc_attr( $this->value['color'] ) . '"' . wp_kses_post( $default_color_attr ) . ' />';
378
+ echo '</div>';
379
+ echo '</div>';
380
  }
381
 
382
+ // Custom style.
 
383
  if ( ! empty( $args['custom_style'] ) ) {
384
  echo '<div class="spftestimonial--block spftestimonial--block-custom-style">';
385
  echo '<div class="spftestimonial--title">' . esc_html__( 'Custom Style', 'testimonial-free' ) . '</div>';
386
+ echo '<textarea name="' . esc_attr( $this->field_name( '[custom-style]' ) ) . '" class="spftestimonial--custom-style">' . wp_kses_post( $this->value['custom-style'] ) . '</textarea>';
387
  echo '</div>';
388
  }
389
 
390
+ // Preview.
391
+ $always_preview = ( 'always' !== $args['preview'] ) ? ' hidden' : '';
 
392
 
393
  if ( ! empty( $args['preview'] ) ) {
394
+ echo '<div class="spftestimonial--block spftestimonial--block-preview' . esc_attr( $always_preview ) . '">';
395
  echo '<div class="spftestimonial--toggle fa fa-toggle-off"></div>';
396
+ echo '<div class="spftestimonial--preview">' . wp_kses_post( $args['preview_text'] ) . '</div>';
397
  echo '</div>';
398
  }
399
 
400
+ echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[type]' ) ) . '" class="spftestimonial--type" value="' . esc_attr( $this->value['type'] ) . '" />';
401
+ echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[unit]' ) ) . '" class="spftestimonial--unit-save" value="' . esc_attr( $args['unit'] ) . '" />';
402
 
403
  echo '</div>';
404
 
405
+ echo wp_kses_post( $this->field_after() );
406
 
407
  }
408
 
409
+ /**
410
+ * Create select
411
+ *
412
+ * @param array $options options.
413
+ * @param string $name name.
414
+ * @param mixed $placeholder placeholder.
415
+ * @param bool $is_multiple is_multiple.
416
+ * @return statement
417
+ */
418
  public function create_select( $options, $name, $placeholder = '', $is_multiple = false ) {
419
 
420
  $multiple_name = ( $is_multiple ) ? '[]' : '';
421
  $multiple_attr = ( $is_multiple ) ? ' multiple data-multiple="true"' : '';
422
  $chosen_rtl = ( $this->chosen && is_rtl() ) ? ' chosen-rtl' : '';
423
 
424
+ $output = '<select name="' . esc_attr( $this->field_name( '[' . $name . ']' . $multiple_name ) ) . '" class="spftestimonial--' . esc_attr( $name . $chosen_rtl ) . '" data-placeholder="' . esc_attr( $placeholder ) . '"' . $multiple_attr . '>';
425
  $output .= ( ! empty( $placeholder ) ) ? '<option value="">' . ( ( ! $this->chosen ) ? $placeholder : '' ) . '</option>' : '';
426
 
427
  if ( ! empty( $options ) ) {
428
  foreach ( $options as $option_key => $option_value ) {
429
  if ( $is_multiple ) {
430
+ $selected = ( in_array( $option_value, $this->value[ $name ], true ) ) ? ' selected' : '';
431
+ $output .= '<option value="' . esc_attr( $option_value ) . '"' . esc_attr( $selected ) . '>' . esc_html( $option_value ) . '</option>';
432
  } else {
433
  $option_key = ( is_numeric( $option_key ) ) ? $option_value : $option_key;
434
  $selected = ( $option_key === $this->value[ $name ] ) ? ' selected' : '';
435
+ $output .= '<option value="' . esc_attr( $option_key ) . '"' . esc_attr( $selected ) . '>' . esc_html( $option_value ) . '</option>';
436
  }
437
  }
438
  }
443
 
444
  }
445
 
446
+ /**
447
+ * Enqueue function.
448
+ *
449
+ * @return void
450
+ */
451
  public function enqueue() {
452
 
453
  if ( ! wp_style_is( 'spftestimonial-webfont-loader' ) ) {
454
 
455
  SPFTESTIMONIAL::include_plugin_file( 'fields/typography/google-fonts.php' );
456
 
 
 
457
  $webfonts = array();
458
 
459
  $customwebfonts = apply_filters( 'spftestimonial_field_typography_customwebfonts', array() );
538
 
539
  }
540
 
541
+ /**
542
+ * Enqueue google fonts
543
+ *
544
+ * @return mixed
545
+ */
546
  public function enqueue_google_fonts() {
547
 
548
  $value = $this->value;
550
  $is_google = false;
551
 
552
  if ( ! empty( $this->value['type'] ) ) {
553
+ $is_google = ( 'google' === $this->value['type'] ) ? true : false;
554
  } else {
555
  SPFTESTIMONIAL::include_plugin_file( 'fields/typography/google-fonts.php' );
556
  $is_google = ( array_key_exists( $this->value['font-family'], spftestimonial_get_google_fonts() ) ) ? true : false;
558
 
559
  if ( $is_google ) {
560
 
561
+ // set style.
562
  $font_weight = ( ! empty( $value['font-weight'] ) ) ? $value['font-weight'] : '';
563
  $font_style = ( ! empty( $value['font-style'] ) ) ? $value['font-style'] : '';
564
 
567
  $families['style'][ $style ] = $style;
568
  }
569
 
570
+ // set extra styles.
571
  if ( ! empty( $value['extra-styles'] ) ) {
572
  foreach ( $value['extra-styles'] as $extra_style ) {
573
  $families['style'][ $extra_style ] = $extra_style;
574
  }
575
  }
576
 
577
+ // set subsets.
578
  if ( ! empty( $value['subset'] ) ) {
579
  $value['subset'] = ( is_array( $value['subset'] ) ) ? $value['subset'] : array_filter( (array) $value['subset'] );
580
  foreach ( $value['subset'] as $subset ) {
597
 
598
  }
599
 
600
+ /**
601
+ * Output function
602
+ *
603
+ * @return statement
604
+ */
605
  public function output() {
606
 
607
  $output = '';
616
  $output .= 'font-family:"' . $font_family . '"' . $backup_family . $important . ';';
617
  }
618
 
619
+ // Common font properties.
620
  $properties = array(
621
  'color',
622
  'font-weight',
628
  );
629
 
630
  foreach ( $properties as $property ) {
631
+ if ( isset( $this->value[ $property ] ) && '' !== $this->value[ $property ] ) {
632
  $output .= $property . ':' . $this->value[ $property ] . $important . ';';
633
  }
634
  }
643
  $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : '';
644
 
645
  foreach ( $properties as $property ) {
646
+ if ( isset( $this->value[ $property ] ) && '' !== $this->value[ $property ] ) {
647
  $output .= $property . ':' . $this->value[ $property ] . $unit . $important . ';';
648
  }
649
  }
admin/views/framework/fields/upload/upload.php DELETED
@@ -1,41 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: upload
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_upload' ) ) {
11
- class SPFTESTIMONIAL_Field_upload extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'library' => array(),
21
- 'button_title' => esc_html__( 'Upload', 'testimonial-free' ),
22
- 'remove_title' => esc_html__( 'Remove', 'testimonial-free' ),
23
- ) );
24
-
25
- echo $this->field_before();
26
-
27
- $library = ( is_array( $args['library'] ) ) ? $args['library'] : array_filter( (array) $args['library'] );
28
- $library = ( ! empty( $library ) ) ? implode(',', $library ) : '';
29
- $hidden = ( empty( $this->value ) ) ? ' hidden' : '';
30
-
31
- echo '<div class="spftestimonial--wrap">';
32
- echo '<input type="text" name="'. $this->field_name() .'" value="'. $this->value .'"'. $this->field_attributes() .'/>';
33
- echo '<a href="#" class="button button-primary spftestimonial--button" data-library="'. esc_attr( $library ) .'">'. $args['button_title'] .'</a>';
34
- echo '<a href="#" class="button button-secondary spftestimonial-warning-primary spftestimonial--remove'. $hidden .'">'. $args['remove_title'] .'</a>';
35
- echo '</div>';
36
-
37
- echo $this->field_after();
38
-
39
- }
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/fields/wp_editor/wp_editor.php DELETED
@@ -1,103 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
- /**
3
- *
4
- * Field: wp_editor
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
- *
9
- */
10
- if( ! class_exists( 'SPFTESTIMONIAL_Field_wp_editor' ) ) {
11
- class SPFTESTIMONIAL_Field_wp_editor extends SPFTESTIMONIAL_Fields {
12
-
13
- public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14
- parent::__construct( $field, $value, $unique, $where, $parent );
15
- }
16
-
17
- public function render() {
18
-
19
- $args = wp_parse_args( $this->field, array(
20
- 'tinymce' => true,
21
- 'quicktags' => true,
22
- 'media_buttons' => true,
23
- 'height' => '',
24
- ) );
25
-
26
- $attributes = array(
27
- 'rows' => 10,
28
- 'class' => 'wp-editor-area',
29
- 'autocomplete' => 'off',
30
- );
31
-
32
- $editor_height = ( ! empty( $args['height'] ) ) ? ' style="height:'. $args['height']. ';"' : '';
33
-
34
- $editor_settings = array(
35
- 'tinymce' => $args['tinymce'],
36
- 'quicktags' => $args['quicktags'],
37
- 'media_buttons' => $args['media_buttons'],
38
- );
39
-
40
- echo $this->field_before();
41
-
42
- echo ( spftestimonial_wp_editor_api() ) ? '<div class="spftestimonial-wp-editor" data-editor-settings="'. esc_attr( wp_json_encode( $editor_settings ) ) .'">' : '';
43
-
44
- echo '<textarea name="'. $this->field_name() .'"'. $this->field_attributes( $attributes ) . $editor_height .'>'. $this->value .'</textarea>';
45
-
46
- echo '<div class="clear"></div>';
47
-
48
- echo ( spftestimonial_wp_editor_api() ) ? '</div>' : '';
49
-
50
- echo $this->field_after();
51
-
52
- }
53
-
54
- public function enqueue() {
55
-
56
- if( spftestimonial_wp_editor_api() && function_exists( 'wp_enqueue_editor' ) ) {
57
-
58
- wp_enqueue_editor();
59
-
60
- $this->setup_wp_editor_settings();
61
-
62
- add_action( 'print_default_editor_scripts', array( &$this, 'setup_wp_editor_media_buttons' ) );
63
-
64
- }
65
-
66
- }
67
-
68
- // Setup wp editor media buttons
69
- public function setup_wp_editor_media_buttons() {
70
-
71
- ob_start();
72
- echo '<div class="wp-media-buttons">';
73
- do_action( 'media_buttons' );
74
- echo '</div>';
75
- $media_buttons = ob_get_clean();
76
-
77
- echo '<script type="text/javascript">';
78
- echo 'var spftestimonial_media_buttons = '. wp_json_encode( $media_buttons ) .';';
79
- echo '</script>';
80
-
81
- }
82
-
83
- // Setup wp editor settings
84
- public function setup_wp_editor_settings() {
85
-
86
- if( spftestimonial_wp_editor_api() && class_exists( '_WP_Editors') ) {
87
-
88
- $defaults = apply_filters( 'spftestimonial_wp_editor', array(
89
- 'tinymce' => array(
90
- 'wp_skip_init' => true
91
- ),
92
- ) );
93
-
94
- $setup = _WP_Editors::parse_settings( 'spftestimonial_wp_editor', $defaults );
95
-
96
- _WP_Editors::editor_settings( 'spftestimonial_wp_editor', $setup );
97
-
98
- }
99
-
100
- }
101
-
102
- }
103
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/functions/actions.php CHANGED
@@ -1,117 +1,70 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
-
3
  /**
 
4
  *
5
- * Export
6
- *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  *
 
 
10
  */
11
- if( ! function_exists( 'spftestimonial_export' ) ) {
12
- function spftestimonial_export() {
13
-
14
- if( ! empty( $_GET['export'] ) && ! empty( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'spftestimonial_backup_nonce' ) ) {
15
-
16
- header('Content-Type: application/json');
17
- header('Content-disposition: attachment; filename=backup-'. gmdate( 'd-m-Y' ) .'.json');
18
- header('Content-Transfer-Encoding: binary');
19
- header('Pragma: no-cache');
20
- header('Expires: 0');
21
-
22
- echo json_encode( get_option( wp_unslash( $_GET['export'] ) ) );
23
 
24
- }
25
-
26
- die();
27
- }
28
- add_action( 'wp_ajax_spftestimonial-export', 'spftestimonial_export' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
- /**
32
- *
33
- * Import Ajax
34
- *
35
- * @since 1.0.0
36
- * @version 1.0.0
37
- *
38
- */
39
- if( ! function_exists( 'spftestimonial_import_ajax' ) ) {
40
- function spftestimonial_import_ajax() {
41
-
42
- if( ! empty( $_POST['import_data'] ) && ! empty( $_POST['unique'] ) && ! empty( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'spftestimonial_backup_nonce' ) ) {
43
-
44
- $import_data = json_decode( wp_unslash( trim( $_POST['import_data'] ) ), true );
45
-
46
- if( is_array( $import_data ) ) {
47
 
48
- update_option( wp_unslash( $_POST['unique'] ), wp_unslash( $import_data ) );
49
- wp_send_json_success();
50
 
51
- }
52
 
53
- }
54
 
55
- wp_send_json_error( array( 'error' => esc_html__( 'Error: Nonce verification has failed. Please try again.', 'testimonial-free' ) ) );
56
-
57
- }
58
- add_action( 'wp_ajax_spftestimonial-import', 'spftestimonial_import_ajax' );
59
- }
60
-
61
- /**
62
- *
63
- * Reset Ajax
64
- *
65
- * @since 1.0.0
66
- * @version 1.0.0
67
- *
68
- */
69
- if( ! function_exists( 'spftestimonial_reset_ajax' ) ) {
70
- function spftestimonial_reset_ajax() {
71
 
72
- if( ! empty( $_POST['unique'] ) && ! empty( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'spftestimonial_backup_nonce' ) ) {
73
- delete_option( wp_unslash( $_POST['unique'] ) );
74
- wp_send_json_success();
75
- }
76
 
77
- wp_send_json_error( array( 'error' => esc_html__( 'Error: Nonce verification has failed. Please try again.', 'testimonial-free' ) ) );
 
 
 
 
 
78
 
79
- }
80
- add_action( 'wp_ajax_spftestimonial-reset', 'spftestimonial_reset_ajax' );
81
  }
82
 
83
- /**
84
- *
85
- * Chosen Ajax
86
- *
87
- * @since 1.0.0
88
- * @version 1.0.0
89
- *
90
- */
91
- if( ! function_exists( 'spftestimonial_chosen_ajax' ) ) {
92
- function spftestimonial_chosen_ajax() {
93
-
94
- if( ! empty( $_POST['term'] ) && ! empty( $_POST['type'] ) && ! empty( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'spftestimonial_chosen_ajax_nonce' ) ) {
95
-
96
- $capability = apply_filters( 'spftestimonial_chosen_ajax_capability', 'manage_options' );
97
-
98
- if( current_user_can( $capability ) ) {
99
-
100
- $type = $_POST['type'];
101
- $term = $_POST['term'];
102
- $query_args = ( ! empty( $_POST['query_args'] ) ) ? $_POST['query_args'] : array();
103
- $options = SPFTESTIMONIAL_Fields::field_data( $type, $term, $query_args );
104
-
105
- wp_send_json_success( $options );
106
-
107
- } else {
108
- wp_send_json_error( array( 'error' => esc_html__( 'You do not have required permissions to access.', 'testimonial-free' ) ) );
109
- }
110
-
111
- } else {
112
- wp_send_json_error( array( 'error' => esc_html__( 'Error: Nonce verification has failed. Please try again.', 'testimonial-free' ) ) );
113
- }
114
-
115
- }
116
- add_action( 'wp_ajax_spftestimonial-chosen', 'spftestimonial_chosen_ajax' );
117
- }
1
+ <?php
 
2
  /**
3
+ * Framework actions file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! function_exists( 'spftestimonial_reset_ajax' ) ) {
17
+ /**
18
+ *
19
+ * Reset Ajax
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ function spftestimonial_reset_ajax() {
25
+
26
+ if ( ! empty( $_POST['unique'] ) && ! empty( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'spftestimonial_backup_nonce' ) ) {
27
+ delete_option( sanitize_text_field( wp_unslash( $_POST['unique'] ) ) );
28
+ wp_send_json_success();
29
+ }
30
+
31
+ wp_send_json_error( array( 'error' => esc_html__( 'Error: Nonce verification has failed. Please try again.', 'testimonial-free' ) ) );
32
+
33
+ }
34
+ add_action( 'wp_ajax_spftestimonial-reset', 'spftestimonial_reset_ajax' );
35
  }
36
 
37
+ if ( ! function_exists( 'spftestimonial_chosen_ajax' ) ) {
38
+ /**
39
+ *
40
+ * Chosen Ajax
41
+ *
42
+ * @since 1.0.0
43
+ * @version 1.0.0
44
+ */
45
+ function spftestimonial_chosen_ajax() {
 
 
 
 
 
 
 
46
 
47
+ if ( ! empty( $_POST['term'] ) && ! empty( $_POST['type'] ) && ! empty( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'spftestimonial_chosen_ajax_nonce' ) ) {
 
48
 
49
+ $capability = apply_filters( 'spftestimonial_chosen_ajax_capability', 'manage_options' );
50
 
51
+ if ( current_user_can( $capability ) ) {
52
 
53
+ $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
54
+ $term = sanitize_text_field( wp_unslash( $_POST['term'] ) );
55
+ $query_args = ( ! empty( $_POST['query_args'] ) ) ? wp_kses_post_deep( $_POST['query_args'] ) : array(); // phpcs:ignore
56
+ $options = SPFTESTIMONIAL_Fields::field_data( $type, $term, $query_args );
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ wp_send_json_success( $options );
 
 
 
59
 
60
+ } else {
61
+ wp_send_json_error( array( 'error' => esc_html__( 'You do not have required permissions to access.', 'testimonial-free' ) ) );
62
+ }
63
+ } else {
64
+ wp_send_json_error( array( 'error' => esc_html__( 'Error: Nonce verification has failed. Please try again.', 'testimonial-free' ) ) );
65
+ }
66
 
67
+ }
68
+ add_action( 'wp_ajax_spftestimonial-chosen', 'spftestimonial_chosen_ajax' );
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/framework/functions/customize.php CHANGED
@@ -1,116 +1,165 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * WP Customize custom panel
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! class_exists( 'WP_Customize_Panel_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Panel' ) ) {
11
- class WP_Customize_Panel_SPFTESTIMONIAL extends WP_Customize_Panel {
12
- public $type = 'spftestimonial';
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
- /**
17
- *
18
- * WP Customize custom section
19
- *
20
- * @since 1.0.0
21
- * @version 1.0.0
22
- *
23
- */
24
- if( ! class_exists( 'WP_Customize_Section_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Section' ) ) {
25
- class WP_Customize_Section_SPFTESTIMONIAL extends WP_Customize_Section {
26
- public $type = 'spftestimonial';
27
- }
 
 
 
 
 
28
  }
29
 
30
- /**
31
- *
32
- * WP Customize custom control
33
- *
34
- * @since 1.0.0
35
- * @version 1.0.0
36
- *
37
- */
38
- if( ! class_exists( 'WP_Customize_Control_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Control' ) ) {
39
- class WP_Customize_Control_SPFTESTIMONIAL extends WP_Customize_Control {
40
-
41
- public $type = 'spftestimonial';
42
- public $field = '';
43
- public $unique = '';
44
-
45
- protected function render() {
46
-
47
- $depend = '';
48
- $hidden = '';
49
-
50
- if ( ! empty( $this->field['dependency'] ) ) {
51
- $hidden = ' spftestimonial-dependency-control hidden';
52
- $depend .= ' data-controller="'. $this->field['dependency'][0] .'"';
53
- $depend .= ' data-condition="'. $this->field['dependency'][1] .'"';
54
- $depend .= ' data-value="'. $this->field['dependency'][2] .'"';
55
- }
56
-
57
- $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
58
- $class = 'customize-control customize-control-' . $this->type . $hidden;
59
-
60
- echo '<li id="'. $id .'" class="'. $class .'"'. $depend .'>';
61
- $this->render_content();
62
- echo '</li>';
63
-
64
- }
65
-
66
- public function render_content() {
67
-
68
- $complex = array(
69
- 'accordion',
70
- 'background',
71
- 'backup',
72
- 'border',
73
- 'button_set',
74
- 'checkbox',
75
- 'color_group',
76
- 'date',
77
- 'dimensions',
78
- 'fieldset',
79
- 'group',
80
- 'image_select',
81
- 'link_color',
82
- 'media',
83
- 'palette',
84
- 'repeater',
85
- 'sortable',
86
- 'sorter',
87
- 'spacing',
88
- 'switcher',
89
- 'tabbed',
90
- 'typography'
91
- );
92
-
93
- $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
94
- $custom = ( ! empty( $this->field['customizer'] ) ) ? true : false;
95
- $is_complex = ( in_array( $this->field['type'], $complex ) ) ? true : false;
96
- $class = ( $is_complex || $custom ) ? ' spftestimonial-customize-complex' : '';
97
- $atts = ( $is_complex || $custom ) ? ' data-unique-id="'. $this->unique .'" data-option-id="'. $field_id .'"' : '';
98
-
99
- if( ! $is_complex && ! $custom ) {
100
- $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
101
- }
102
-
103
- $this->field['name'] = $this->settings['default']->id;
104
-
105
- $this->field['dependency'] = array();
106
-
107
- echo '<div class="spftestimonial-customize-field'. $class .'"'. $atts .'>';
108
-
109
- SPFTESTIMONIAL::field( $this->field, $this->value(), $this->unique, 'customize' );
110
-
111
- echo '</div>';
112
-
113
- }
114
-
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
 
1
+ <?php
2
  /**
3
+ * Framework customize file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! class_exists( 'WP_Customize_Panel_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Panel' ) ) {
17
+ /**
18
+ *
19
+ * WP Customize custom panel
20
+ *
21
+ * @since 1.0.0
22
+ * @version 1.0.0
23
+ */
24
+ class WP_Customize_Panel_SPFTESTIMONIAL extends WP_Customize_Panel {
25
+
26
+ /**
27
+ * Post type.
28
+ *
29
+ * @var string
30
+ */
31
+ public $type = 'spftestimonial';
32
+ }
33
  }
34
 
35
+ if ( ! class_exists( 'WP_Customize_Section_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Section' ) ) {
36
+ /**
37
+ *
38
+ * WP Customize custom section
39
+ *
40
+ * @since 1.0.0
41
+ * @version 1.0.0
42
+ */
43
+ class WP_Customize_Section_SPFTESTIMONIAL extends WP_Customize_Section {
44
+
45
+ /**
46
+ * Post type.
47
+ *
48
+ * @var string
49
+ */
50
+ public $type = 'spftestimonial';
51
+ }
52
  }
53
 
54
+ if ( ! class_exists( 'WP_Customize_Control_SPFTESTIMONIAL' ) && class_exists( 'WP_Customize_Control' ) ) {
55
+ /**
56
+ *
57
+ * WP Customize custom control
58
+ *
59
+ * @since 1.0.0
60
+ * @version 1.0.0
61
+ */
62
+ class WP_Customize_Control_SPFTESTIMONIAL extends WP_Customize_Control {
63
+
64
+ /**
65
+ * Post type.
66
+ *
67
+ * @var string
68
+ */
69
+ public $type = 'spftestimonial';
70
+ /**
71
+ * Post field.
72
+ *
73
+ * @var string
74
+ */
75
+ public $field = '';
76
+ /**
77
+ * Post unique id.
78
+ *
79
+ * @var string
80
+ */
81
+ public $unique = '';
82
+
83
+ /**
84
+ * Render function.
85
+ *
86
+ * @return void
87
+ */
88
+ protected function render() {
89
+
90
+ $depend = '';
91
+ $hidden = '';
92
+
93
+ if ( ! empty( $this->field['dependency'] ) ) {
94
+ $hidden = ' spftestimonial-dependency-control hidden';
95
+ $depend .= ' data-controller="' . $this->field['dependency'][0] . '"';
96
+ $depend .= ' data-condition="' . $this->field['dependency'][1] . '"';
97
+ $depend .= ' data-value="' . $this->field['dependency'][2] . '"';
98
+ }
99
+
100
+ $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
101
+ $class = 'customize-control customize-control-' . $this->type . $hidden;
102
+
103
+ echo '<li id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '"' . wp_kses_post( $depend ) . '>';
104
+ $this->render_content();
105
+ echo '</li>';
106
+
107
+ }
108
+
109
+ /**
110
+ * Render content function.
111
+ *
112
+ * @return void
113
+ */
114
+ public function render_content() {
115
+
116
+ $complex = array(
117
+ 'accordion',
118
+ 'background',
119
+ 'backup',
120
+ 'border',
121
+ 'button_set',
122
+ 'checkbox',
123
+ 'color_group',
124
+ 'date',
125
+ 'dimensions',
126
+ 'fieldset',
127
+ 'group',
128
+ 'image_select',
129
+ 'link_color',
130
+ 'media',
131
+ 'palette',
132
+ 'repeater',
133
+ 'sortable',
134
+ 'sorter',
135
+ 'spacing',
136
+ 'switcher',
137
+ 'tabbed',
138
+ 'typography',
139
+ );
140
+
141
+ $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
142
+ $custom = ( ! empty( $this->field['customizer'] ) ) ? true : false;
143
+ $is_complex = ( in_array( $this->field['type'], $complex, true ) ) ? true : false;
144
+ $class = ( $is_complex || $custom ) ? ' spftestimonial-customize-complex' : '';
145
+ $atts = ( $is_complex || $custom ) ? ' data-unique-id="' . $this->unique . '" data-option-id="' . $field_id . '"' : '';
146
+
147
+ if ( ! $is_complex && ! $custom ) {
148
+ $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
149
+ }
150
+
151
+ $this->field['name'] = $this->settings['default']->id;
152
+
153
+ $this->field['dependency'] = array();
154
+
155
+ echo '<div class="spftestimonial-customize-field' . esc_attr( $class ) . '"' . wp_kses_post( $atts ) . '>';
156
+
157
+ SPFTESTIMONIAL::field( $this->field, $this->value(), $this->unique, 'customize' );
158
+
159
+ echo '</div>';
160
+
161
+ }
162
+
163
+ }
164
  }
165
+
admin/views/framework/functions/deprecated.php CHANGED
@@ -1,7 +1,18 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  *
4
  * Deprecated framework functions from past framework versions. You shouldn't use these
5
  * functions and look for the alternatives instead. The functions will be removed in a later version.
6
- *
7
  */
1
+ <?php
2
+ /**
3
+ * Framework deprecated file.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
  /**
15
  *
16
  * Deprecated framework functions from past framework versions. You shouldn't use these
17
  * functions and look for the alternatives instead. The functions will be removed in a later version.
 
18
  */
admin/views/framework/functions/helpers.php CHANGED
@@ -1,111 +1,122 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Array search key & value
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if ( ! function_exists( 'spftestimonial_array_search' ) ) {
11
- function spftestimonial_array_search( $array, $key, $value ) {
12
-
13
- $results = array();
14
-
15
- if ( is_array( $array ) ) {
16
- if ( isset( $array[$key] ) && $array[$key] == $value ) {
17
- $results[] = $array;
18
- }
19
-
20
- foreach ( $array as $sub_array ) {
21
- $results = array_merge( $results, spftestimonial_array_search( $sub_array, $key, $value ) );
22
- }
23
 
24
- }
 
 
25
 
26
- return $results;
27
-
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
- /**
32
- *
33
- * Getting POST Var
34
- *
35
- * @since 1.0.0
36
- * @version 1.0.0
37
- *
38
- */
39
  if ( ! function_exists( 'spftestimonial_get_var' ) ) {
40
- function spftestimonial_get_var( $var, $default = '' ) {
41
-
42
- if( isset( $_POST[$var] ) ) {
43
- return $_POST[$var];
44
- }
45
-
46
- if( isset( $_GET[$var] ) ) {
47
- return $_GET[$var];
48
- }
49
-
50
- return $default;
51
-
52
- }
 
 
 
 
 
 
 
53
  }
54
 
55
- /**
56
- *
57
- * Getting POST Vars
58
- *
59
- * @since 1.0.0
60
- * @version 1.0.0
61
- *
62
- */
63
  if ( ! function_exists( 'spftestimonial_get_vars' ) ) {
64
- function spftestimonial_get_vars( $var, $depth, $default = '' ) {
65
-
66
- if( isset( $_POST[$var][$depth] ) ) {
67
- return $_POST[$var][$depth];
68
- }
69
-
70
- if( isset( $_GET[$var][$depth] ) ) {
71
- return $_GET[$var][$depth];
72
- }
73
-
74
- return $default;
75
-
76
- }
 
 
 
 
 
 
 
 
77
  }
78
 
79
- /**
80
- *
81
- * Between Microtime
82
- *
83
- * @since 1.0.0
84
- * @version 1.0.0
85
- *
86
- */
87
  if ( ! function_exists( 'spftestimonial_microtime' ) ) {
88
- function spftestimonial_timeout( $timenow, $starttime, $timeout = 30 ) {
89
-
90
- return ( ( $timenow - $starttime ) < $timeout ) ? true : false;
91
-
92
- }
 
 
 
 
 
 
 
 
93
  }
94
 
95
- /**
96
- *
97
- * Check for wp editor api
98
- *
99
- * @since 1.0.0
100
- * @version 1.0.0
101
- *
102
- */
103
  if ( ! function_exists( 'spftestimonial_wp_editor_api' ) ) {
104
- function spftestimonial_wp_editor_api() {
 
 
 
 
 
 
 
105
 
106
- global $wp_version;
107
 
108
- return version_compare( $wp_version, '4.8', '>=' );
109
 
110
- }
111
  }
1
+ <?php
2
  /**
3
+ * Framework helpers file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
 
16
+ if ( ! function_exists( 'spftestimonial_array_search' ) ) {
17
+ /**
18
+ * Array search key & value
19
+ *
20
+ * @param mixed $array main array.
21
+ * @param mixed $key key.
22
+ * @param mixed $value val.
23
+ * @return array
24
+ */
25
+ function spftestimonial_array_search( $array, $key, $value ) {
26
+
27
+ $results = array();
28
+
29
+ if ( is_array( $array ) ) {
30
+ if ( isset( $array[ $key ] ) && $array[ $key ] === $value ) {
31
+ $results[] = $array;
32
+ }
33
+
34
+ foreach ( $array as $sub_array ) {
35
+ $results = array_merge( $results, spftestimonial_array_search( $sub_array, $key, $value ) );
36
+ }
37
+ }
38
+
39
+ return $results;
40
+
41
+ }
42
  }
43
 
 
 
 
 
 
 
 
 
44
  if ( ! function_exists( 'spftestimonial_get_var' ) ) {
45
+ /**
46
+ * Getting POST Var
47
+ *
48
+ * @param mixed $var var.
49
+ * @param mixed $default default.
50
+ * @return mixed
51
+ */
52
+ function spftestimonial_get_var( $var, $default = '' ) {
53
+
54
+ if ( isset( $_POST[ $var ] ) ) { // phpcs:ignore
55
+ return $_POST[ $var ]; // phpcs:ignore
56
+ }
57
+
58
+ if ( isset( $_GET[ $var ] ) ) { // phpcs:ignore
59
+ return $_GET[ $var ]; // phpcs:ignore
60
+ }
61
+
62
+ return $default;
63
+
64
+ }
65
  }
66
 
 
 
 
 
 
 
 
 
67
  if ( ! function_exists( 'spftestimonial_get_vars' ) ) {
68
+ /**
69
+ * Getting POST Vars
70
+ *
71
+ * @param mixed $var var.
72
+ * @param mixed $depth depth.
73
+ * @param mixed $default default.
74
+ * @return mixed
75
+ */
76
+ function spftestimonial_get_vars( $var, $depth, $default = '' ) {
77
+
78
+ if ( isset( $_POST[ $var ][ $depth ] ) ) { // phpcs:ignore
79
+ return $_POST[ $var ][ $depth ]; // phpcs:ignore
80
+ }
81
+
82
+ if ( isset( $_GET[ $var ][ $depth ] ) ) { // phpcs:ignore
83
+ return $_GET[ $var ][ $depth ]; // phpcs:ignore
84
+ }
85
+
86
+ return $default;
87
+
88
+ }
89
  }
90
 
 
 
 
 
 
 
 
 
91
  if ( ! function_exists( 'spftestimonial_microtime' ) ) {
92
+ /**
93
+ * Between Microtime
94
+ *
95
+ * @param string $timenow now.
96
+ * @param string $starttime start.
97
+ * @param int $timeout timeout.
98
+ * @return bool
99
+ */
100
+ function spftestimonial_timeout( $timenow, $starttime, $timeout = 30 ) {
101
+
102
+ return ( ( $timenow - $starttime ) < $timeout ) ? true : false;
103
+
104
+ }
105
  }
106
 
 
 
 
 
 
 
 
 
107
  if ( ! function_exists( 'spftestimonial_wp_editor_api' ) ) {
108
+ /**
109
+ *
110
+ * Check for wp editor api
111
+ *
112
+ * @since 1.0.0
113
+ * @version 1.0.0
114
+ */
115
+ function spftestimonial_wp_editor_api() {
116
 
117
+ global $wp_version;
118
 
119
+ return version_compare( $wp_version, '4.8', '>=' );
120
 
121
+ }
122
  }
admin/views/framework/functions/sanitize.php CHANGED
@@ -1,29 +1,49 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Sanitize
5
- * Replace letter a to letter b
6
- *
7
- * @since 1.0.0
8
- * @version 1.0.0
9
  *
 
 
10
  */
11
- if( ! function_exists( 'spftestimonial_sanitize_replace_a_to_b' ) ) {
12
- function spftestimonial_sanitize_replace_a_to_b( $value ) {
13
- return str_replace( 'a', 'b', $value );
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
- /**
18
- *
19
- * Sanitize title
20
- *
21
- * @since 1.0.0
22
- * @version 1.0.0
23
- *
24
- */
25
- if( ! function_exists( 'spftestimonial_sanitize_title' ) ) {
26
- function spftestimonial_sanitize_title( $value ) {
27
- return sanitize_title( $value );
28
- }
 
 
 
29
  }
1
+ <?php
2
  /**
3
+ * Framework sanitize file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! function_exists( 'spftestimonial_sanitize_replace_a_to_b' ) ) {
17
+ /**
18
+ *
19
+ * Sanitize
20
+ * Replace letter a to letter b
21
+ *
22
+ * @param string $value string.
23
+ *
24
+ * @return string
25
+ * @since 1.0.0
26
+ * @version 1.0.0
27
+ */
28
+ function spftestimonial_sanitize_replace_a_to_b( $value ) {
29
+
30
+ return str_replace( 'a', 'b', $value );
31
+ }
32
  }
33
 
34
+ if ( ! function_exists( 'spftestimonial_sanitize_title' ) ) {
35
+ /**
36
+ *
37
+ * Sanitize title
38
+ *
39
+ * @param string $value string.
40
+ *
41
+ * @return string
42
+ * @since 1.0.0
43
+ * @version 1.0.0
44
+ */
45
+ function spftestimonial_sanitize_title( $value ) {
46
+
47
+ return sanitize_title( $value );
48
+ }
49
  }
admin/views/framework/functions/validate.php CHANGED
@@ -1,152 +1,173 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2
  /**
 
3
  *
4
- * Email validate
5
- *
6
- * @since 1.0.0
7
- * @version 1.0.0
8
  *
 
 
9
  */
10
- if( ! function_exists( 'spftestimonial_validate_email' ) ) {
11
- function spftestimonial_validate_email( $value ) {
12
-
13
- if ( ! filter_var( $value, FILTER_VALIDATE_EMAIL ) ) {
14
- return esc_html__( 'Please write a valid email address!', 'testimonial-free' );
15
- }
16
 
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
- /**
21
- *
22
- * Numeric validate
23
- *
24
- * @since 1.0.0
25
- * @version 1.0.0
26
- *
27
- */
28
- if( ! function_exists( 'spftestimonial_validate_numeric' ) ) {
29
- function spftestimonial_validate_numeric( $value ) {
30
 
31
- if ( ! is_numeric( $value ) ) {
32
- return esc_html__( 'Please write a numeric data!', 'testimonial-free' );
33
- }
34
 
35
- }
36
  }
37
 
38
- /**
39
- *
40
- * Required validate
41
- *
42
- * @since 1.0.0
43
- * @version 1.0.0
44
- *
45
- */
46
- if( ! function_exists( 'spftestimonial_validate_required' ) ) {
47
- function spftestimonial_validate_required( $value ) {
48
-
49
- if ( empty( $value ) ) {
50
- return esc_html__( 'Error! This field is required!', 'testimonial-free' );
51
- }
52
-
53
- }
54
  }
55
 
56
- /**
57
- *
58
- * URL validate
59
- *
60
- * @since 1.0.0
61
- * @version 1.0.0
62
- *
63
- */
64
- if( ! function_exists( 'spftestimonial_validate_url' ) ) {
65
- function spftestimonial_validate_url( $value ) {
66
-
67
- if( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
68
- return esc_html__( 'Please write a valid url!', 'testimonial-free' );
69
- }
70
-
71
- }
72
  }
73
 
74
- /**
75
- *
76
- * Email validate for Customizer
77
- *
78
- * @since 1.0.0
79
- * @version 1.0.0
80
- *
81
- */
82
- if( ! function_exists( 'spftestimonial_customize_validate_email' ) ) {
83
- function spftestimonial_customize_validate_email( $validity, $value, $wp_customize ) {
84
-
85
- if ( ! sanitize_email( $value ) ) {
86
- $validity->add( 'required', esc_html__( 'Please write a valid email address!', 'testimonial-free' ) );
87
- }
88
-
89
- return $validity;
90
-
91
- }
 
 
92
  }
93
 
94
- /**
95
- *
96
- * Numeric validate for Customizer
97
- *
98
- * @since 1.0.0
99
- * @version 1.0.0
100
- *
101
- */
102
- if( ! function_exists( 'spftestimonial_customize_validate_numeric' ) ) {
103
- function spftestimonial_customize_validate_numeric( $validity, $value, $wp_customize ) {
104
-
105
- if ( ! is_numeric( $value ) ) {
106
- $validity->add( 'required', esc_html__( 'Please write a numeric data!', 'testimonial-free' ) );
107
- }
108
-
109
- return $validity;
110
-
111
- }
 
 
 
112
  }
113
 
114
- /**
115
- *
116
- * Required validate for Customizer
117
- *
118
- * @since 1.0.0
119
- * @version 1.0.0
120
- *
121
- */
122
- if( ! function_exists( 'spftestimonial_customize_validate_required' ) ) {
123
- function spftestimonial_customize_validate_required( $validity, $value, $wp_customize ) {
124
-
125
- if ( empty( $value ) ) {
126
- $validity->add( 'required', esc_html__( 'Error! This field is required!', 'testimonial-free' ) );
127
- }
128
-
129
- return $validity;
130
-
131
- }
 
 
132
  }
133
 
134
- /**
135
- *
136
- * URL validate for Customizer
137
- *
138
- * @since 1.0.0
139
- * @version 1.0.0
140
- *
141
- */
142
- if( ! function_exists( 'spftestimonial_customize_validate_url' ) ) {
143
- function spftestimonial_customize_validate_url( $validity, $value, $wp_customize ) {
144
-
145
- if( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
146
- $validity->add( 'required', esc_html__( 'Please write a valid url!', 'testimonial-free' ) );
147
- }
148
-
149
- return $validity;
150
-
151
- }
 
 
152
  }
 
1
+ <?php
2
  /**
3
+ * Framework validate file.
4
  *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
 
 
7
  *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/framework
10
  */
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die;
14
+ } // Cannot access directly.
15
+
16
+ if ( ! function_exists( 'spftestimonial_validate_email' ) ) {
17
+ /**
18
+ * Email validate
19
+ *
20
+ * @param string $value email.
21
+ * @return string
22
+ * @since 1.0.0
23
+ * @version 1.0.0
24
+ */
25
+ function spftestimonial_validate_email( $value ) {
26
+
27
+ if ( ! filter_var( $value, FILTER_VALIDATE_EMAIL ) ) {
28
+ return esc_html__( 'Please write a valid email address!', 'testimonial-free' );
29
+ }
30
+
31
+ }
32
  }
33
 
34
+ if ( ! function_exists( 'spftestimonial_validate_numeric' ) ) {
35
+ /**
36
+ * Numeric validate
37
+ *
38
+ * @param int $value int.
39
+ * @return int
40
+ */
41
+ function spftestimonial_validate_numeric( $value ) {
 
 
42
 
43
+ if ( ! is_numeric( $value ) ) {
44
+ return esc_html__( 'Please write a numeric data!', 'testimonial-free' );
45
+ }
46
 
47
+ }
48
  }
49
 
50
+ if ( ! function_exists( 'spftestimonial_validate_required' ) ) {
51
+ /**
52
+ * Required validate
53
+ *
54
+ * @param string $value string.
55
+ * @return string
56
+ * @since 1.0.0
57
+ * @version 1.0.0
58
+ */
59
+ function spftestimonial_validate_required( $value ) {
60
+ if ( empty( $value ) ) {
61
+ return esc_html__( 'Error! This field is required!', 'testimonial-free' );
62
+ }
63
+
64
+ }
 
65
  }
66
 
67
+ if ( ! function_exists( 'spftestimonial_validate_url' ) ) {
68
+ /**
69
+ * URL validate
70
+ *
71
+ * @param string $value value.
72
+ * @return string
73
+ * @since 1.0.0
74
+ * @version 1.0.0
75
+ */
76
+ function spftestimonial_validate_url( $value ) {
77
+
78
+ if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
79
+ return esc_html__( 'Please write a valid url!', 'testimonial-free' );
80
+ }
81
+
82
+ }
83
  }
84
 
85
+ if ( ! function_exists( 'spftestimonial_customize_validate_email' ) ) {
86
+ /**
87
+ *
88
+ * Email validate for Customizer
89
+ *
90
+ * @param object $validity Email validity.
91
+ * @param string $value The Email.
92
+ * @param object $wp_customize Customize option.
93
+ * @since 1.0.0
94
+ * @version 1.0.0
95
+ */
96
+ function spftestimonial_customize_validate_email( $validity, $value, $wp_customize ) {
97
+
98
+ if ( ! sanitize_email( $value ) ) {
99
+ $validity->add( 'required', esc_html__( 'Please write a valid email address!', 'testimonial-free' ) );
100
+ }
101
+
102
+ return $validity;
103
+
104
+ }
105
  }
106
 
107
+ if ( ! function_exists( 'spftestimonial_customize_validate_numeric' ) ) {
108
+ /**
109
+ *
110
+ * Numeric validate for Customizer
111
+ *
112
+ * @param object $validity Numeric validity.
113
+ * @param string $value The Numeric.
114
+ * @param object $wp_customize Customize option.
115
+ *
116
+ * @since 1.0.0
117
+ * @version 1.0.0
118
+ */
119
+ function spftestimonial_customize_validate_numeric( $validity, $value, $wp_customize ) {
120
+
121
+ if ( ! is_numeric( $value ) ) {
122
+ $validity->add( 'required', esc_html__( 'Please write a numeric data!', 'testimonial-free' ) );
123
+ }
124
+
125
+ return $validity;
126
+
127
+ }
128
  }
129
 
130
+ if ( ! function_exists( 'spftestimonial_customize_validate_required' ) ) {
131
+ /**
132
+ *
133
+ * Required validate for Customizer
134
+ *
135
+ * @param object $validity Required validity.
136
+ * @param string $value The Required.
137
+ * @param object $wp_customize Customize option.
138
+ * @since 1.0.0
139
+ * @version 1.0.0
140
+ */
141
+ function spftestimonial_customize_validate_required( $validity, $value, $wp_customize ) {
142
+
143
+ if ( empty( $value ) ) {
144
+ $validity->add( 'required', esc_html__( 'Error! This field is required!', 'testimonial-free' ) );
145
+ }
146
+
147
+ return $validity;
148
+
149
+ }
150
  }
151
 
152
+ if ( ! function_exists( 'spftestimonial_customize_validate_url' ) ) {
153
+ /**
154
+ *
155
+ * URL validate for Customizer
156
+ *
157
+ * @param object $validity URL validity.
158
+ * @param string $value The URL.
159
+ * @param object $wp_customize Customize option.
160
+ * @since 1.0.0
161
+ * @version 1.0.0
162
+ */
163
+ function spftestimonial_customize_validate_url( $validity, $value, $wp_customize ) {
164
+
165
+ if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
166
+ $validity->add( 'required', esc_html__( 'Please write a valid url!', 'testimonial-free' ) );
167
+ }
168
+
169
+ return $validity;
170
+
171
+ }
172
  }
173
+
admin/views/mce-button.php CHANGED
@@ -1,16 +1,35 @@
1
  <?php
2
- // Make sure we don't expose any info if called directly
3
- if ( !defined( 'ABSPATH' ) ){
 
 
 
 
 
 
 
 
 
 
4
  exit;
5
  }
6
 
7
- if( !class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
 
 
 
8
  class SP_TFREE_MCE_Shortcode_list {
9
 
 
 
 
 
 
10
  private static $instance;
11
 
12
  /**
13
  * Initiator
 
14
  * @since 2.0
15
  */
16
  public static function init() {
@@ -19,6 +38,7 @@ if( !class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
19
 
20
  /**
21
  * Constructor
 
22
  * @since 2.0
23
  */
24
  public function __construct() {
@@ -27,60 +47,81 @@ if( !class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
27
  add_action( 'admin_head', array( $this, 'tfree_mce_button' ) );
28
  }
29
 
30
- // Hooks your functions into the correct filters
31
- function tfree_mce_button() {
32
- // check user permissions
33
- if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
 
 
 
 
 
34
  return;
35
  }
36
- // check if WYSIWYG is enabled
37
- if ( 'true' == get_user_option( 'rich_editing' ) ) {
38
  add_filter( 'mce_external_plugins', array( $this, 'add_mce_plugin' ) );
39
  add_filter( 'mce_buttons', array( $this, 'register_mce_button' ) );
40
  }
41
  }
42
 
43
- // Script for our mce button
44
- function add_mce_plugin( $plugin_array ) {
 
 
 
 
 
 
45
  $plugin_array['sp_tfree_mce_button'] = SP_TFREE_URL . 'admin/assets/js/mce-button.js';
46
  return $plugin_array;
47
  }
48
 
49
- // Register our button in the editor
50
- function register_mce_button( $buttons ) {
 
 
 
 
 
 
51
  array_push( $buttons, 'sp_tfree_mce_button' );
52
  return $buttons;
53
  }
54
 
55
  /**
56
  * Function to fetch cpt posts list
57
- * @since 2.0
58
- * @return string
 
 
59
  */
60
  public function posts( $post_type ) {
61
 
62
  global $wpdb;
63
- $cpt_type = $post_type;
64
  $cpt_post_status = 'publish';
65
- $cpt = $wpdb->get_results( $wpdb->prepare(
66
- "SELECT ID, post_title
 
67
  FROM $wpdb->posts
68
  WHERE $wpdb->posts.post_type = %s
69
  AND $wpdb->posts.post_status = %s
70
  ORDER BY ID DESC",
71
- $cpt_type,
72
- $cpt_post_status
73
- ) );
 
74
 
75
  $list = array();
76
 
77
  foreach ( $cpt as $post ) {
78
- $selected = '';
79
- $post_id = $post->ID;
80
  $post_name = $post->post_title;
81
- $list[] = array(
82
- 'text' => $post_name,
83
- 'value' => $post_id
84
  );
85
  }
86
 
@@ -89,49 +130,51 @@ if( !class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
89
 
90
  /**
91
  * Function to fetch buttons
 
92
  * @since 2.0
93
  * @return string
94
  */
95
  public function tfree_list_ajax() {
96
- // check for nonce
97
  check_ajax_referer( 'sp-mce-nonce', 'security' );
98
- $posts = $this->posts( 'spt_shortcodes' ); // change 'post' if you need posts list
99
  return $posts;
100
  }
101
 
102
  /**
103
  * Function to output button list ajax script
104
- * @since 2.0
105
- * @return string
 
106
  */
107
  public function tfree_cpt_list() {
108
- // create nonce
109
  global $current_screen;
110
  $current_screen->post_type;
111
- if( $current_screen == 'post' || 'page' ){
112
  $nonce = wp_create_nonce( 'sp-mce-nonce' );
113
  ?>
114
  <script type="text/javascript">
115
- jQuery( document ).ready( function( $ ) {
116
- var data = {
117
- 'action' : 'tfree_cpt_list', // wp ajax action
118
- 'security' : '<?php echo $nonce; ?>' // nonce value created earlier
119
- };
120
- // fire ajax
121
- jQuery.post( ajaxurl, data, function( response ) {
122
- // if nonce fails then not authorized else settings saved
123
- if( response === '-1' ){
124
- // do nothing
125
- console.log('error');
126
- } else {
127
- if (typeof(tinyMCE) != 'undefined') {
128
- if (tinyMCE.activeEditor != null) {
129
- tinyMCE.activeEditor.settings.spTFREEShortcodeList = response;
130
- }
131
- }
132
- }
133
- });
134
- });
135
  </script>
136
  <?php
137
  }
@@ -144,4 +187,4 @@ if( !class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
144
  * Kicking this off
145
  */
146
  $sp_mce_btn = new SP_TFREE_MCE_Shortcode_list();
147
- $sp_mce_btn->init();
1
  <?php
2
+ /**
3
+ * The MCE button.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
+ */
11
+
12
+ // Make sure we don't expose any info if called directly.
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
+ if ( ! class_exists( 'SP_TFREE_MCE_Shortcode_list' ) ) {
18
+ /**
19
+ * The Tiny MCE button class.
20
+ */
21
  class SP_TFREE_MCE_Shortcode_list {
22
 
23
+ /**
24
+ * Instance of the class.
25
+ *
26
+ * @var $instance
27
+ */
28
  private static $instance;
29
 
30
  /**
31
  * Initiator
32
+ *
33
  * @since 2.0
34
  */
35
  public static function init() {
38
 
39
  /**
40
  * Constructor
41
+ *
42
  * @since 2.0
43
  */
44
  public function __construct() {
47
  add_action( 'admin_head', array( $this, 'tfree_mce_button' ) );
48
  }
49
 
50
+ /**
51
+ * Hooks your functions into the correct filters
52
+ *
53
+ * @since 2.0.0
54
+ * @return void
55
+ */
56
+ public function tfree_mce_button() {
57
+ // check user permissions.
58
+ if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
59
  return;
60
  }
61
+ // check if WYSIWYG is enabled.
62
+ if ( 'true' === get_user_option( 'rich_editing' ) ) {
63
  add_filter( 'mce_external_plugins', array( $this, 'add_mce_plugin' ) );
64
  add_filter( 'mce_buttons', array( $this, 'register_mce_button' ) );
65
  }
66
  }
67
 
68
+ /**
69
+ * Script for our mce button.
70
+ *
71
+ * @since 2.0.0
72
+ * @param string $plugin_array The button.
73
+ * @return string
74
+ */
75
+ public function add_mce_plugin( $plugin_array ) {
76
  $plugin_array['sp_tfree_mce_button'] = SP_TFREE_URL . 'admin/assets/js/mce-button.js';
77
  return $plugin_array;
78
  }
79
 
80
+ /**
81
+ * Register our button in the editor.
82
+ *
83
+ * @since 2.0.0
84
+ * @param array $buttons The Tiny mce button.
85
+ * @return array
86
+ */
87
+ public function register_mce_button( $buttons ) {
88
  array_push( $buttons, 'sp_tfree_mce_button' );
89
  return $buttons;
90
  }
91
 
92
  /**
93
  * Function to fetch cpt posts list
94
+ *
95
+ * @since 2.0.0
96
+ * @param string $post_type List of the post type.
97
+ * @return void
98
  */
99
  public function posts( $post_type ) {
100
 
101
  global $wpdb;
102
+ $cpt_type = $post_type;
103
  $cpt_post_status = 'publish';
104
+ $cpt = $wpdb->get_results(
105
+ $wpdb->prepare(
106
+ "SELECT ID, post_title
107
  FROM $wpdb->posts
108
  WHERE $wpdb->posts.post_type = %s
109
  AND $wpdb->posts.post_status = %s
110
  ORDER BY ID DESC",
111
+ $cpt_type,
112
+ $cpt_post_status
113
+ )
114
+ );
115
 
116
  $list = array();
117
 
118
  foreach ( $cpt as $post ) {
119
+ $selected = '';
120
+ $post_id = $post->ID;
121
  $post_name = $post->post_title;
122
+ $list[] = array(
123
+ 'text' => $post_name,
124
+ 'value' => $post_id,
125
  );
126
  }
127
 
130
 
131
  /**
132
  * Function to fetch buttons
133
+ *
134
  * @since 2.0
135
  * @return string
136
  */
137
  public function tfree_list_ajax() {
138
+ // check for nonce.
139
  check_ajax_referer( 'sp-mce-nonce', 'security' );
140
+ $posts = $this->posts( 'spt_shortcodes' ); // change 'post' if you need posts list.
141
  return $posts;
142
  }
143
 
144
  /**
145
  * Function to output button list ajax script
146
+ *
147
+ * @since 2.0.0
148
+ * @return void
149
  */
150
  public function tfree_cpt_list() {
151
+ // create nonce.
152
  global $current_screen;
153
  $current_screen->post_type;
154
+ if ( 'post' || 'page' === $current_screen ) {
155
  $nonce = wp_create_nonce( 'sp-mce-nonce' );
156
  ?>
157
  <script type="text/javascript">
158
+ jQuery( document ).ready( function( $ ) {
159
+ var data = {
160
+ 'action' : 'tfree_cpt_list', // wp ajax action
161
+ 'security' : '<?php echo esc_attr( $nonce ); ?>' // nonce value created earlier.
162
+ };
163
+ // fire ajax
164
+ jQuery.post( ajaxurl, data, function( response ) {
165
+ // if nonce fails then not authorized else settings saved
166
+ if( response === '-1' ){
167
+ // do nothing
168
+ console.log('error');
169
+ } else {
170
+ if (typeof(tinyMCE) != 'undefined') {
171
+ if (tinyMCE.activeEditor != null) {
172
+ tinyMCE.activeEditor.settings.spTFREEShortcodeList = response;
173
+ }
174
+ }
175
+ }
176
+ });
177
+ });
178
  </script>
179
  <?php
180
  }
187
  * Kicking this off
188
  */
189
  $sp_mce_btn = new SP_TFREE_MCE_Shortcode_list();
190
+ $sp_mce_btn->init();
admin/views/notices/review.php CHANGED
@@ -9,8 +9,17 @@
9
  * @subpackage Testimonial/admin/views/notices
10
  * @author ShapedPlugin<support@shapedplugin.com>
11
  */
 
 
 
 
12
  class Testimonial_Review {
13
 
 
 
 
 
 
14
  public function __construct() {
15
  add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
16
  add_action( 'wp_ajax_sp-tfree-never-show-review-notice', array( $this, 'dismiss_review_notice' ) );
@@ -53,7 +62,7 @@ class Testimonial_Review {
53
  ?>
54
  <div id="sp-tfree-review-notice" class="sp-tfree-review-notice">
55
  <div class="sp-tfree-plugin-icon">
56
- <img src="<?php echo SP_TFREE_URL . 'admin/assets/images/Testimonial-icon1.svg'; ?>" alt="Testimonial">
57
  </div>
58
  <div class="sp-tfree-notice-text">
59
  <h3>Enjoying <strong>Testimonial</strong>?</h3>
@@ -87,7 +96,8 @@ class Testimonial_Review {
87
 
88
  $.post( ajaxurl, {
89
  action: 'sp-tfree-never-show-review-notice',
90
- notice_dismissed_data : notice_dismissed_value
 
91
  });
92
 
93
  $('#sp-tfree-review-notice.sp-tfree-review-notice').hide();
@@ -106,10 +116,16 @@ class Testimonial_Review {
106
  * @return void
107
  **/
108
  public function dismiss_review_notice() {
 
 
 
 
 
 
109
  if ( ! $review ) {
110
  $review = array();
111
  }
112
- switch ( $_POST['notice_dismissed_data'] ) {
113
  case '1':
114
  $review['time'] = time();
115
  $review['dismissed'] = false;
9
  * @subpackage Testimonial/admin/views/notices
10
  * @author ShapedPlugin<support@shapedplugin.com>
11
  */
12
+
13
+ /**
14
+ * Admin review notice class.
15
+ */
16
  class Testimonial_Review {
17
 
18
+ /**
19
+ * Constructor
20
+ *
21
+ * @since 2.0
22
+ */
23
  public function __construct() {
24
  add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
25
  add_action( 'wp_ajax_sp-tfree-never-show-review-notice', array( $this, 'dismiss_review_notice' ) );
62
  ?>
63
  <div id="sp-tfree-review-notice" class="sp-tfree-review-notice">
64
  <div class="sp-tfree-plugin-icon">
65
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/Testimonial-icon1.svg' ); ?>" alt="Testimonial">
66
  </div>
67
  <div class="sp-tfree-notice-text">
68
  <h3>Enjoying <strong>Testimonial</strong>?</h3>
96
 
97
  $.post( ajaxurl, {
98
  action: 'sp-tfree-never-show-review-notice',
99
+ notice_dismissed_data : notice_dismissed_value,
100
+ nonce: '<?php echo esc_attr( wp_create_nonce( 'sp_tfree_review_notice' ) ); ?>'
101
  });
102
 
103
  $('#sp-tfree-review-notice.sp-tfree-review-notice').hide();
116
  * @return void
117
  **/
118
  public function dismiss_review_notice() {
119
+ $post_data = wp_unslash( $_POST );
120
+
121
+ if ( ! isset( $post_data['nonce'] ) || ! wp_verify_nonce( sanitize_key( $post_data['nonce'] ), 'sp_tfree_review_notice' ) ) {
122
+ return;
123
+ }
124
+
125
  if ( ! $review ) {
126
  $review = array();
127
  }
128
+ switch ( isset( $post_data['notice_dismissed_data'] ) ? $post_data['notice_dismissed_data'] : '' ) {
129
  case '1':
130
  $review['time'] = time();
131
  $review['dismissed'] = false;
admin/views/scripts.php CHANGED
@@ -1,4 +1,13 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
@@ -10,12 +19,16 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  class SP_TFREE_Admin_Scripts {
11
 
12
  /**
 
 
13
  * @var null
14
  * @since 2.0
15
  */
16
  protected static $_instance = null;
17
 
18
  /**
 
 
19
  * @return SP_TFREE_Admin_Scripts
20
  * @since 2.0
21
  */
1
  <?php
2
+ /**
3
+ * Admin page Scripts and styles enqueue.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
+ */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
19
  class SP_TFREE_Admin_Scripts {
20
 
21
  /**
22
+ * Instance of the class.
23
+ *
24
  * @var null
25
  * @since 2.0
26
  */
27
  protected static $_instance = null;
28
 
29
  /**
30
+ * Initiator
31
+ *
32
  * @return SP_TFREE_Admin_Scripts
33
  * @since 2.0
34
  */
admin/views/testimonial-form.php CHANGED
@@ -1,4 +1,15 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
 
 
 
 
 
 
 
 
 
 
 
2
  die; } // Cannot access directly.
3
  //
4
  // Metabox of the testimonial form generator.
@@ -290,34 +301,6 @@ SPFTESTIMONIAL::createSection(
290
  'accordions' => array(
291
  array(
292
  'title' => __( 'Location', 'testimonial-free' ),
293
- /*
294
- 'fields' => array(
295
- array(
296
- 'id' => 'label',
297
- 'type' => 'text',
298
- 'class' => 'pro_only_field',
299
- 'attributes' => array( 'disabled' => 'disabled' ),
300
- 'title' => __( 'Label', 'testimonial-free' ),
301
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
302
- 'default' => __( 'Location', 'testimonial-free' ),
303
- ),
304
- array(
305
- 'id' => 'placeholder',
306
- 'type' => 'text',
307
- 'class' => 'pro_only_field',
308
- 'attributes' => array( 'disabled' => 'disabled' ),
309
- 'title' => __( 'Placeholder', 'testimonial-free' ),
310
- 'default' => __( 'What is your location?', 'testimonial-free' ),
311
- ),
312
- array(
313
- 'id' => 'required',
314
- 'type' => 'checkbox',
315
- 'class' => 'pro_only_field',
316
- 'attributes' => array( 'disabled' => 'disabled' ),
317
- 'title' => __( 'Required', 'testimonial-free' ),
318
- 'default' => false,
319
- ),
320
- ), */
321
  ),
322
  ),
323
  'dependency' => array( 'form_elements', 'any', 'location', true ),
@@ -329,34 +312,6 @@ SPFTESTIMONIAL::createSection(
329
  'accordions' => array(
330
  array(
331
  'title' => __( 'Phone or Mobile', 'testimonial-free' ),
332
- /*
333
- 'fields' => array(
334
- array(
335
- 'id' => 'label',
336
- 'type' => 'text',
337
- 'class' => 'pro_only_field',
338
- 'attributes' => array( 'disabled' => 'disabled' ),
339
- 'title' => __( 'Label', 'testimonial-free' ),
340
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
341
- 'default' => __( 'Phone or Mobile', 'testimonial-free' ),
342
- ),
343
- array(
344
- 'id' => 'placeholder',
345
- 'type' => 'text',
346
- 'class' => 'pro_only_field',
347
- 'attributes' => array( 'disabled' => 'disabled' ),
348
- 'title' => __( 'Placeholder', 'testimonial-free' ),
349
- 'default' => __( 'What is your phone number?', 'testimonial-free' ),
350
- ),
351
- array(
352
- 'id' => 'required',
353
- 'type' => 'checkbox',
354
- 'class' => 'pro_only_field',
355
- 'attributes' => array( 'disabled' => 'disabled' ),
356
- 'title' => __( 'Required', 'testimonial-free' ),
357
- 'default' => false,
358
- ),
359
- ), */
360
  ),
361
  ),
362
  'dependency' => array( 'form_elements', 'any', 'phone_mobile', true ),
@@ -368,34 +323,6 @@ SPFTESTIMONIAL::createSection(
368
  'accordions' => array(
369
  array(
370
  'title' => __( 'Website', 'testimonial-free' ),
371
- /*
372
- 'fields' => array(
373
- array(
374
- 'id' => 'label',
375
- 'type' => 'text',
376
- 'class' => 'pro_only_field',
377
- 'attributes' => array( 'disabled' => 'disabled' ),
378
- 'title' => __( 'Label', 'testimonial-free' ),
379
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
380
- 'default' => __( 'Website', 'testimonial-free' ),
381
- ),
382
- array(
383
- 'id' => 'placeholder',
384
- 'type' => 'text',
385
- 'class' => 'pro_only_field',
386
- 'attributes' => array( 'disabled' => 'disabled' ),
387
- 'title' => __( 'Placeholder', 'testimonial-free' ),
388
- 'default' => __( 'What is your website?', 'testimonial-free' ),
389
- ),
390
- array(
391
- 'id' => 'required',
392
- 'type' => 'checkbox',
393
- 'class' => 'pro_only_field',
394
- 'attributes' => array( 'disabled' => 'disabled' ),
395
- 'title' => __( 'Required', 'testimonial-free' ),
396
- 'default' => false,
397
- ),
398
- ), */
399
  ),
400
  ),
401
  'dependency' => array( 'form_elements', 'any', 'website', true ),
@@ -407,34 +334,6 @@ SPFTESTIMONIAL::createSection(
407
  'accordions' => array(
408
  array(
409
  'title' => __( 'Video URL', 'testimonial-free' ),
410
- /*
411
- 'fields' => array(
412
- array(
413
- 'id' => 'label',
414
- 'type' => 'text',
415
- 'class' => 'pro_only_field',
416
- 'attributes' => array( 'disabled' => 'disabled' ),
417
- 'title' => __( 'Label', 'testimonial-free' ),
418
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
419
- 'default' => __( 'Video URL', 'testimonial-free' ),
420
- ),
421
- array(
422
- 'id' => 'placeholder',
423
- 'type' => 'text',
424
- 'class' => 'pro_only_field',
425
- 'attributes' => array( 'disabled' => 'disabled' ),
426
- 'title' => __( 'Placeholder', 'testimonial-free' ),
427
- 'default' => __( 'Type video URL.', 'testimonial-free' ),
428
- ),
429
- array(
430
- 'id' => 'required',
431
- 'type' => 'checkbox',
432
- 'class' => 'pro_only_field',
433
- 'attributes' => array( 'disabled' => 'disabled' ),
434
- 'title' => __( 'Required', 'testimonial-free' ),
435
- 'default' => false,
436
- ),
437
- ), */
438
  ),
439
  ),
440
  'dependency' => array( 'form_elements', 'any', 'video_url', true ),
@@ -446,18 +345,6 @@ SPFTESTIMONIAL::createSection(
446
  'accordions' => array(
447
  array(
448
  'title' => __( 'Rating', 'testimonial-free' ),
449
- /*
450
- 'fields' => array(
451
- array(
452
- 'id' => 'label',
453
- 'type' => 'text',
454
- 'class' => 'pro_only_field',
455
- 'attributes' => array( 'disabled' => 'disabled' ),
456
- 'title' => __( 'Label', 'testimonial-free' ),
457
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
458
- 'default' => __( 'Rating', 'testimonial-free' ),
459
- ),
460
- ), */
461
  ),
462
  ),
463
  'dependency' => array( 'form_elements', 'any', 'rating', true ),
@@ -469,30 +356,6 @@ SPFTESTIMONIAL::createSection(
469
  'accordions' => array(
470
  array(
471
  'title' => __( 'Social Profile', 'testimonial-free' ),
472
- /*
473
- 'fields' => array(
474
- array(
475
- 'id' => 'label',
476
- 'type' => 'text',
477
- 'class' => 'pro_only_field',
478
- 'attributes' => array( 'disabled' => 'disabled' ),
479
- 'title' => __( 'Label', 'testimonial-free' ),
480
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
481
- 'default' => __( 'Social Profile', 'testimonial-free' ),
482
- ),
483
- array(
484
- 'id' => 'social_profile_list',
485
- 'type' => 'select',
486
- 'class' => 'pro_only_field',
487
- 'title' => __( 'Select Social Profile(s)', 'testimonial-free' ),
488
- 'desc' => __( 'Select social profile for the frontend form. Leave blank for the all socials.', 'testimonial-free' ),
489
- 'options' => 'social_profile_name_list',
490
- 'placeholder' => __( 'Select Social Profile(s)', 'testimonial-free' ),
491
- 'chosen' => true,
492
- 'multiple' => true,
493
- 'sortable' => true,
494
- ),
495
- ), */
496
  ),
497
  ),
498
  'dependency' => array( 'form_elements', 'any', 'social_profile', true ),
@@ -504,17 +367,6 @@ SPFTESTIMONIAL::createSection(
504
  'accordions' => array(
505
  array(
506
  'title' => __( 'reCAPTCHA', 'testimonial-free' ),
507
- /*
508
- 'fields' => array(
509
- array(
510
- 'id' => 'label',
511
- 'type' => 'text',
512
- 'class' => 'pro_only_field',
513
- 'attributes' => array( 'disabled' => 'disabled' ),
514
- 'title' => __( 'Label', 'testimonial-free' ),
515
- 'desc' => __( 'To hide this label, leave it empty.', 'testimonial-free' ),
516
- ),
517
- ), */
518
  ),
519
  ),
520
  'dependency' => array( 'form_elements', 'any', 'recaptcha', true ),
@@ -526,18 +378,6 @@ SPFTESTIMONIAL::createSection(
526
  'accordions' => array(
527
  array(
528
  'title' => __( 'Submit Button', 'testimonial-free' ),
529
- /*
530
- 'fields' => array(
531
- array(
532
- 'id' => 'label',
533
- 'type' => 'text',
534
- 'class' => 'pro_only_field',
535
- 'attributes' => array( 'disabled' => 'disabled' ),
536
- 'title' => __( 'Label', 'testimonial-free' ),
537
- 'desc' => __( 'Type submit button label.', 'testimonial-free' ),
538
- 'default' => __( 'Submit Testimonial', 'testimonial-free' ),
539
- ),
540
- ), */
541
  ),
542
  ),
543
  ),
1
+ <?php
2
+ /**
3
+ * Testimonial form page.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  die; } // Cannot access directly.
14
  //
15
  // Metabox of the testimonial form generator.
301
  'accordions' => array(
302
  array(
303
  'title' => __( 'Location', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  ),
305
  ),
306
  'dependency' => array( 'form_elements', 'any', 'location', true ),
312
  'accordions' => array(
313
  array(
314
  'title' => __( 'Phone or Mobile', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  ),
316
  ),
317
  'dependency' => array( 'form_elements', 'any', 'phone_mobile', true ),
323
  'accordions' => array(
324
  array(
325
  'title' => __( 'Website', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  ),
327
  ),
328
  'dependency' => array( 'form_elements', 'any', 'website', true ),
334
  'accordions' => array(
335
  array(
336
  'title' => __( 'Video URL', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  ),
338
  ),
339
  'dependency' => array( 'form_elements', 'any', 'video_url', true ),
345
  'accordions' => array(
346
  array(
347
  'title' => __( 'Rating', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
348
  ),
349
  ),
350
  'dependency' => array( 'form_elements', 'any', 'rating', true ),
356
  'accordions' => array(
357
  array(
358
  'title' => __( 'Social Profile', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  ),
360
  ),
361
  'dependency' => array( 'form_elements', 'any', 'social_profile', true ),
367
  'accordions' => array(
368
  array(
369
  'title' => __( 'reCAPTCHA', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
370
  ),
371
  ),
372
  'dependency' => array( 'form_elements', 'any', 'recaptcha', true ),
378
  'accordions' => array(
379
  array(
380
  'title' => __( 'Submit Button', 'testimonial-free' ),
 
 
 
 
 
 
 
 
 
 
 
 
381
  ),
382
  ),
383
  ),
admin/views/testimonial-metaboxs.php CHANGED
@@ -1,10 +1,24 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
2
- die; } // Cannot access directly.
3
-
4
  /**
5
- * Sanitize function for text field.
 
 
 
 
 
 
6
  */
 
 
 
 
7
  if ( ! function_exists( 'spftestimonial_sanitize_text' ) ) {
 
 
 
 
 
 
8
  function spftestimonial_sanitize_text( $value ) {
9
 
10
  $safe_text = filter_var( $value, FILTER_SANITIZE_STRING );
1
+ <?php
 
 
2
  /**
3
+ * The testimonial Metabox configuration.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
  */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ die; } // Cannot access directly.
14
+
15
  if ( ! function_exists( 'spftestimonial_sanitize_text' ) ) {
16
+ /**
17
+ * Sanitize function for text field.
18
+ *
19
+ * @param string $value sanitize value.
20
+ * @return string
21
+ */
22
  function spftestimonial_sanitize_text( $value ) {
23
 
24
  $safe_text = filter_var( $value, FILTER_SANITIZE_STRING );
admin/views/testimonial-settings.php CHANGED
@@ -1,4 +1,15 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
 
 
 
 
 
 
 
 
 
 
 
2
  die; } // Cannot access directly.
3
 
4
  //
@@ -11,8 +22,8 @@ $prefix = 'sp_testimonial_pro_options';
11
  //
12
  $url = 'https://wordpress.org/support/plugin/testimonial-free/reviews/?filter=5#new-post';
13
  $text = sprintf(
14
- __( 'If you like <strong>Testimonial</strong> please leave us a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. Your Review is very important to us as it helps us to grow more. ', 'testimonial-free' ),
15
- $url
16
  );
17
 
18
  //
@@ -57,7 +68,6 @@ SPFTESTIMONIAL::createSection(
57
  'id' => 'tpro_dequeue_google_fonts',
58
  'type' => 'switcher',
59
  'title' => __( 'Google Fonts', 'testimonial-free' ),
60
- // 'subtitle' => __( 'Enqueue/dequeue google fonts.', 'testimonial-free' ),
61
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
62
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
63
  'text_width' => 95,
@@ -73,7 +83,6 @@ SPFTESTIMONIAL::createSection(
73
  'id' => 'tf_dequeue_slick_js',
74
  'type' => 'switcher',
75
  'title' => __( 'Slick JS', 'testimonial-free' ),
76
- // 'subtitle' => __( 'Enqueue/dequeue slick JS.', 'testimonial-free' ),
77
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
78
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
79
  'text_width' => 95,
@@ -87,7 +96,6 @@ SPFTESTIMONIAL::createSection(
87
  'id' => 'tf_dequeue_slick_css',
88
  'type' => 'switcher',
89
  'title' => __( 'Slick CSS', 'testimonial-free' ),
90
- // 'subtitle' => __( 'Enqueue/dequeue slick CSS.', 'testimonial-free' ),
91
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
92
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
93
  'text_width' => 95,
@@ -97,24 +105,11 @@ SPFTESTIMONIAL::createSection(
97
  'id' => 'tf_dequeue_fa_css',
98
  'type' => 'switcher',
99
  'title' => __( 'Font Awesome CSS', 'testimonial-free' ),
100
- // 'subtitle' => __( 'Enqueue/dequeue font awesome CSS.', 'testimonial-free' ),
101
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
102
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
103
  'text_width' => 95,
104
  'default' => true,
105
  ),
106
- /*
107
- array(
108
- 'id' => 'tpro_dequeue_magnific_popup_css',
109
- 'type' => 'switcher',
110
- 'title' => __( 'Magnific Popup CSS', 'testimonial-free' ),
111
- // 'subtitle' => __( 'Enqueue/dequeue magnific popup CSS.', 'testimonial-free' ),
112
- 'text_on' => __( 'Enqueue', 'testimonial-free' ),
113
- 'text_off' => __( 'Dequeue', 'testimonial-free' ),
114
- 'text_width' => 95,
115
- 'default' => true,
116
- ), */
117
-
118
  ),
119
  )
120
  );
@@ -147,7 +142,7 @@ SPFTESTIMONIAL::createSection(
147
  )
148
  );
149
 
150
- // Field: reCAPTCHA
151
  SPFTESTIMONIAL::createSection(
152
  $prefix,
153
  array(
@@ -172,7 +167,6 @@ href="https://www.google.com/recaptcha/admin#list" target="_blank"> Get your API
172
  'class' => 'pro_only_field',
173
  'attributes' => array( 'disabled' => 'disabled' ),
174
  'title' => __( 'Site key', 'testimonial-free' ),
175
- // 'subtitle' => __( 'Set Site key.', 'testimonial-free' ),
176
  ),
177
  array(
178
  'id' => 'captcha_secret_key',
@@ -180,7 +174,6 @@ href="https://www.google.com/recaptcha/admin#list" target="_blank"> Get your API
180
  'class' => 'pro_only_field',
181
  'attributes' => array( 'disabled' => 'disabled' ),
182
  'title' => __( 'Secret key', 'testimonial-free' ),
183
- // 'subtitle' => __( 'Set Secret key.', 'testimonial-free' ),
184
  ),
185
 
186
  ),
1
+ <?php
2
+ /**
3
+ * The testimonial settings configuration.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  die; } // Cannot access directly.
14
 
15
  //
22
  //
23
  $url = 'https://wordpress.org/support/plugin/testimonial-free/reviews/?filter=5#new-post';
24
  $text = sprintf(
25
+ wp_kses_post( 'If you like <strong>Testimonial</strong> please leave us a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. Your Review is very important to us as it helps us to grow more.' ),
26
+ esc_url( $url )
27
  );
28
 
29
  //
68
  'id' => 'tpro_dequeue_google_fonts',
69
  'type' => 'switcher',
70
  'title' => __( 'Google Fonts', 'testimonial-free' ),
 
71
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
72
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
73
  'text_width' => 95,
83
  'id' => 'tf_dequeue_slick_js',
84
  'type' => 'switcher',
85
  'title' => __( 'Slick JS', 'testimonial-free' ),
 
86
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
87
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
88
  'text_width' => 95,
96
  'id' => 'tf_dequeue_slick_css',
97
  'type' => 'switcher',
98
  'title' => __( 'Slick CSS', 'testimonial-free' ),
 
99
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
100
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
101
  'text_width' => 95,
105
  'id' => 'tf_dequeue_fa_css',
106
  'type' => 'switcher',
107
  'title' => __( 'Font Awesome CSS', 'testimonial-free' ),
 
108
  'text_on' => __( 'Enqueue', 'testimonial-free' ),
109
  'text_off' => __( 'Dequeue', 'testimonial-free' ),
110
  'text_width' => 95,
111
  'default' => true,
112
  ),
 
 
 
 
 
 
 
 
 
 
 
 
113
  ),
114
  )
115
  );
142
  )
143
  );
144
 
145
+ // Field: reCAPTCHA.
146
  SPFTESTIMONIAL::createSection(
147
  $prefix,
148
  array(
167
  'class' => 'pro_only_field',
168
  'attributes' => array( 'disabled' => 'disabled' ),
169
  'title' => __( 'Site key', 'testimonial-free' ),
 
170
  ),
171
  array(
172
  'id' => 'captcha_secret_key',
174
  'class' => 'pro_only_field',
175
  'attributes' => array( 'disabled' => 'disabled' ),
176
  'title' => __( 'Secret key', 'testimonial-free' ),
 
177
  ),
178
 
179
  ),
admin/views/testimonial-tools.php CHANGED
@@ -1,4 +1,15 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) {
 
 
 
 
 
 
 
 
 
 
 
2
  die; } // Cannot access directly.
3
  //
4
  // Set a unique slug-like ID.
@@ -50,7 +61,7 @@ SPFTESTIMONIAL::createSection(
50
  'id' => 'lcp_post',
51
  'class' => 'spt_post_id',
52
  'type' => 'select',
53
- 'title' => __( ' ', 'testimonial-free' ),
54
  'options' => 'spt_shortcodes',
55
  'chosen' => true,
56
  'sortable' => false,
1
+ <?php
2
+ /**
3
+ * The testimonial tools configuration.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin/views
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  die; } // Cannot access directly.
14
  //
15
  // Set a unique slug-like ID.
61
  'id' => 'lcp_post',
62
  'class' => 'spt_post_id',
63
  'type' => 'select',
64
+ 'title' => ' ',
65
  'options' => 'spt_shortcodes',
66
  'chosen' => true,
67
  'sortable' => false,
admin/views/widget.php CHANGED
@@ -1,6 +1,16 @@
1
  <?php
2
  /**
3
- * Testimonial Widget
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * @since 2.0
6
  */
@@ -9,11 +19,22 @@ function sp_testimonial_free_widget() {
9
  }
10
  add_action( 'widgets_init', 'sp_testimonial_free_widget' );
11
 
 
 
 
 
 
12
  class TFREE_Widget_Content extends WP_Widget {
13
 
14
- function __construct() {
 
 
 
 
 
15
  parent::__construct(
16
- 'TFREE_Widget_Content', __( 'Testimonial', 'testimonial-free' ),
 
17
  array(
18
  'description' => __( 'Display Testimonials.', 'testimonial-free' ),
19
  )
@@ -26,8 +47,14 @@ class TFREE_Widget_Content extends WP_Widget {
26
  * @param array $args
27
  * @param array $instance
28
  */
 
 
 
 
 
 
 
29
  public function widget( $args, $instance ) {
30
- extract( $args );
31
 
32
  $title = apply_filters( 'widget_title', esc_attr( $instance['title'] ) );
33
  $shortcode_id = isset( $instance['shortcode_id'] ) ? absint( $instance['shortcode_id'] ) : 0;
@@ -36,21 +63,21 @@ class TFREE_Widget_Content extends WP_Widget {
36
  return;
37
  }
38
 
39
- echo $args['before_widget'];
40
 
41
  if ( ! empty( $title ) ) {
42
- echo $args['before_title'] . $title . $args['after_title'];
43
  }
44
 
45
  echo do_shortcode( '[sp_testimonial id=' . $shortcode_id . ']' );
46
- echo $args['after_widget'];
47
  }
48
 
49
 
50
  /**
51
  * Outputs the options form on admin
52
  *
53
- * @param array $instance The widget options
54
  */
55
  public function form( $instance ) {
56
  $shortcodes = $this->shortcodes_list();
@@ -59,28 +86,28 @@ class TFREE_Widget_Content extends WP_Widget {
59
 
60
  if ( count( $shortcodes ) > 0 ) {
61
 
62
- echo sprintf( '<p><label for="%1$s">%2$s</label>', $this->get_field_id( 'title' ), __( 'Title:', 'testimonial-free' ) );
63
- echo sprintf( '<input type="text" class="widefat" id="%1$s" name="%2$s" value="%3$s" /></p>', $this->get_field_id( 'title' ), $this->get_field_name( 'title' ), $title );
64
 
65
- echo sprintf( '<p><label>%s</label>', __( 'Testimonial Shortcodes:', 'testimonial-free' ) );
66
- echo sprintf( '<select class="widefat" name="%s">', $this->get_field_name( 'shortcode_id' ) );
67
  foreach ( $shortcodes as $shortcode ) {
68
- $selected = $shortcode->id == $shortcode_id ? 'selected="selected"' : '';
69
  echo sprintf(
70
  '<option value="%1$d" %3$s>%2$s</option>',
71
- $shortcode->id,
72
- $shortcode->title,
73
- $selected
74
  );
75
  }
76
  echo '</select></p>';
77
 
78
  } else {
79
  echo sprintf(
80
- '<p>%1$s <a href="' . admin_url( 'post-new.php?post_type=spt_shortcodes' ) . '">%3$s</a> %2$s</p>',
81
- __( 'You did not generate any shortcode yet.', 'testimonial-free' ),
82
- __( 'to generate a new shortcode now.', 'testimonial-free' ),
83
- __( 'click here', 'testimonial-free' )
84
  );
85
  }
86
  }
@@ -88,8 +115,8 @@ class TFREE_Widget_Content extends WP_Widget {
88
  /**
89
  * Processing widget options on save
90
  *
91
- * @param array $new_instance The new options
92
- * @param array $old_instance The previous options
93
  */
94
  public function update( $new_instance, $old_instance ) {
95
  $instance = array();
@@ -99,6 +126,11 @@ class TFREE_Widget_Content extends WP_Widget {
99
  return $instance;
100
  }
101
 
 
 
 
 
 
102
  private function shortcodes_list() {
103
  $shortcodes = get_posts(
104
  array(
@@ -117,7 +149,8 @@ class TFREE_Widget_Content extends WP_Widget {
117
  'id' => absint( $shortcode->ID ),
118
  'title' => esc_html( $shortcode->post_title ),
119
  );
120
- }, $shortcodes
 
121
  );
122
  }
123
 
1
  <?php
2
  /**
3
+ * Testimonial Widget.
4
+ *
5
+ * @link https://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free
9
+ * @subpackage Testimonial_free/admin
10
+ */
11
+
12
+ /**
13
+ * Testimonial Widget register
14
  *
15
  * @since 2.0
16
  */
19
  }
20
  add_action( 'widgets_init', 'sp_testimonial_free_widget' );
21
 
22
+ /**
23
+ * Testimonial Widget class
24
+ *
25
+ * @since 2.0
26
+ */
27
  class TFREE_Widget_Content extends WP_Widget {
28
 
29
+ /**
30
+ * Constructor of the class.
31
+ *
32
+ * @since 2.0.0
33
+ */
34
+ public function __construct() {
35
  parent::__construct(
36
+ 'TFREE_Widget_Content',
37
+ __( 'Testimonial', 'testimonial-free' ),
38
  array(
39
  'description' => __( 'Display Testimonials.', 'testimonial-free' ),
40
  )
47
  * @param array $args
48
  * @param array $instance
49
  */
50
+ /**
51
+ * Front-End display of widget.
52
+ *
53
+ * @param array $args args.
54
+ * @param mixed $instance instance.
55
+ * @return void
56
+ */
57
  public function widget( $args, $instance ) {
 
58
 
59
  $title = apply_filters( 'widget_title', esc_attr( $instance['title'] ) );
60
  $shortcode_id = isset( $instance['shortcode_id'] ) ? absint( $instance['shortcode_id'] ) : 0;
63
  return;
64
  }
65
 
66
+ echo wp_kses_post( $args['before_widget'] );
67
 
68
  if ( ! empty( $title ) ) {
69
+ echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] );
70
  }
71
 
72
  echo do_shortcode( '[sp_testimonial id=' . $shortcode_id . ']' );
73
+ echo wp_kses_post( $args['after_widget'] );
74
  }
75
 
76
 
77
  /**
78
  * Outputs the options form on admin
79
  *
80
+ * @param array $instance The widget options.
81
  */
82
  public function form( $instance ) {
83
  $shortcodes = $this->shortcodes_list();
86
 
87
  if ( count( $shortcodes ) > 0 ) {
88
 
89
+ echo sprintf( '<p><label for="%1$s">%2$s</label>', esc_attr( $this->get_field_id( 'title' ) ), esc_html__( 'Title:', 'testimonial-free' ) );
90
+ echo sprintf( '<input type="text" class="widefat" id="%1$s" name="%2$s" value="%3$s" /></p>', esc_attr( $this->get_field_id( 'title' ) ), esc_attr( $this->get_field_name( 'title' ) ), esc_attr( $title ) );
91
 
92
+ echo sprintf( '<p><label>%s</label>', esc_html__( 'Testimonial Shortcodes:', 'testimonial-free' ) );
93
+ echo sprintf( '<select class="widefat" name="%s">', esc_attr( $this->get_field_name( 'shortcode_id' ) ) );
94
  foreach ( $shortcodes as $shortcode ) {
95
+ $selected = $shortcode->id === $shortcode_id ? 'selected="selected"' : '';
96
  echo sprintf(
97
  '<option value="%1$d" %3$s>%2$s</option>',
98
+ esc_attr( $shortcode->id ),
99
+ esc_html( $shortcode->title ),
100
+ esc_attr( $selected )
101
  );
102
  }
103
  echo '</select></p>';
104
 
105
  } else {
106
  echo sprintf(
107
+ '<p>%1$s <a href="' . esc_url( admin_url( 'post-new.php?post_type=spt_shortcodes' ) ) . '">%3$s</a> %2$s</p>',
108
+ esc_html__( 'You did not generate any shortcode yet.', 'testimonial-free' ),
109
+ esc_html__( 'to generate a new shortcode now.', 'testimonial-free' ),
110
+ esc_html__( 'click here', 'testimonial-free' )
111
  );
112
  }
113
  }
115
  /**
116
  * Processing widget options on save
117
  *
118
+ * @param array $new_instance The new options.
119
+ * @param array $old_instance The previous options.
120
  */
121
  public function update( $new_instance, $old_instance ) {
122
  $instance = array();
126
  return $instance;
127
  }
128
 
129
+ /**
130
+ * Shortcode list.
131
+ *
132
+ * @return array
133
+ */
134
  private function shortcodes_list() {
135
  $shortcodes = get_posts(
136
  array(
149
  'id' => absint( $shortcode->ID ),
150
  'title' => esc_html( $shortcode->post_title ),
151
  );
152
+ },
153
+ $shortcodes
154
  );
155
  }
156
 
class/router.php CHANGED
@@ -1,4 +1,13 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
@@ -12,6 +21,8 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  class SP_TFREE_Router {
13
 
14
  /**
 
 
15
  * @var SP_TFREE_Router single instance of the class
16
  *
17
  * @since 2.0
@@ -40,17 +51,17 @@ class SP_TFREE_Router {
40
  * @since 1.0
41
  * @return void
42
  */
43
- function includes() {
44
  include_once SP_TFREE_PATH . 'includes/free/loader.php';
45
  }
46
 
47
  /**
48
- * function
49
  *
50
  * @since 1.0
51
  * @return void
52
  */
53
- function sp_tfree_function() {
54
  include_once SP_TFREE_PATH . 'includes/functions.php';
55
  }
56
 
1
  <?php
2
+ /**
3
+ * Router class.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit; // Exit if accessed directly.
21
  class SP_TFREE_Router {
22
 
23
  /**
24
+ * Single instance of the class.
25
+ *
26
  * @var SP_TFREE_Router single instance of the class
27
  *
28
  * @since 2.0
51
  * @since 1.0
52
  * @return void
53
  */
54
+ public function includes() {
55
  include_once SP_TFREE_PATH . 'includes/free/loader.php';
56
  }
57
 
58
  /**
59
+ * Sp tfree function.
60
  *
61
  * @since 1.0
62
  * @return void
63
  */
64
+ public function sp_tfree_function() {
65
  include_once SP_TFREE_PATH . 'includes/functions.php';
66
  }
67
 
class/shortcodes.php CHANGED
@@ -8,7 +8,12 @@
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit; // Exit if accessed directly.
10
  }
11
-
 
 
 
 
 
12
  class SP_TFREE_Shortcodes {
13
 
14
  /**
@@ -44,10 +49,11 @@ class SP_TFREE_Shortcodes {
44
  /**
45
  * Shortcode Post Type
46
  */
47
- function register_post_type() {
48
 
49
  register_post_type(
50
- 'spt_shortcodes', array(
 
51
  'label' => __( 'Manage Views', 'testimonial-free' ),
52
  'description' => __( 'Manage Views', 'testimonial-free' ),
53
  'public' => false,
@@ -76,7 +82,8 @@ class SP_TFREE_Shortcodes {
76
  )
77
  );
78
  register_post_type(
79
- 'spt_testimonial_form', array(
 
80
  'label' => __( 'Forms', 'testimonial-pro' ),
81
  'description' => __( 'Generate forms for Frontend.', 'testimonial-pro' ),
82
  'public' => false,
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit; // Exit if accessed directly.
10
  }
11
+ /**
12
+ * SP_TFREE_Shortcodes class.
13
+ *
14
+ * @var self
15
+ * @since 2.0
16
+ */
17
  class SP_TFREE_Shortcodes {
18
 
19
  /**
49
  /**
50
  * Shortcode Post Type
51
  */
52
+ public function register_post_type() {
53
 
54
  register_post_type(
55
+ 'spt_shortcodes',
56
+ array(
57
  'label' => __( 'Manage Views', 'testimonial-free' ),
58
  'description' => __( 'Manage Views', 'testimonial-free' ),
59
  'public' => false,
82
  )
83
  );
84
  register_post_type(
85
+ 'spt_testimonial_form',
86
+ array(
87
  'label' => __( 'Forms', 'testimonial-pro' ),
88
  'description' => __( 'Generate forms for Frontend.', 'testimonial-pro' ),
89
  'public' => false,
class/testimonial.php CHANGED
@@ -1,4 +1,14 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit; // Exit if accessed directly.
4
  }
@@ -47,7 +57,7 @@ class SP_TFREE_Testimonial {
47
  */
48
  public function spt_testimonial_form_admin_head() {
49
  $screen = get_current_screen();
50
- if ( $screen->post_type == 'spt_testimonial_form' ) {
51
  ?><script>
52
  jQuery(document).ready(function(){
53
  jQuery("#submitdiv #publish, #submitdiv, #submitdiv #save-post").attr("disabled", true).css("opacity", "0.8");
@@ -75,21 +85,31 @@ class SP_TFREE_Testimonial {
75
  $labels = apply_filters(
76
  'sp_testimonial_post_type_labels',
77
  array(
78
- 'name' => __( 'All ' . $plural_name . '', 'testimonial-free' ),
 
79
  'singular_name' => $singular_name,
80
  'menu_name' => $singular_name,
81
- 'all_items' => __( 'All ' . $plural_name . '', 'testimonial-free' ),
 
82
  'add_new' => __( 'Add New', 'testimonial-free' ),
83
  'add_new_item' => __( 'Add New', 'testimonial-free' ),
84
  'edit' => __( 'Edit', 'testimonial-free' ),
85
- 'edit_item' => __( 'Edit ' . $singular_name . '', 'testimonial-free' ),
86
- 'new_item' => __( 'New ' . $singular_name . '', 'testimonial-free' ),
87
- 'search_items' => __( 'Search ' . $plural_name . '', 'testimonial-free' ),
88
- 'not_found' => __( 'No ' . $plural_name . ' found', 'testimonial-free' ),
89
- 'not_found_in_trash' => __( 'No ' . $plural_name . ' found in Trash', 'testimonial-free' ),
90
- 'parent' => __( 'Parent ' . $plural_name . '', 'testimonial-free' ),
91
- 'featured_image' => __( $singular_name . ' Image', 'testimonial-free' ),
92
- 'set_featured_image' => __( 'Set ' . $singular_name . ' image', 'testimonial-free' ),
 
 
 
 
 
 
 
 
93
  'remove_featured_image' => __( 'Remove image', 'testimonial-free' ),
94
  'use_featured_image' => __( 'Use as image', 'testimonial-free' ),
95
  )
@@ -99,7 +119,8 @@ class SP_TFREE_Testimonial {
99
  'sp_testimonial_post_type_args',
100
  array(
101
  'label' => $singular_name,
102
- 'description' => __( $singular_name . ' custom post type.', 'testimonial-free' ),
 
103
  'taxonomies' => array(),
104
  'public' => false,
105
  'has_archive' => false,
@@ -125,9 +146,14 @@ class SP_TFREE_Testimonial {
125
  register_post_type( 'spt_testimonial', $args );
126
  }
127
 
 
 
 
 
 
128
  public function sptfree_conditional_redirect_post_new() {
129
  global $_REQUEST,$pagenow;
130
- if ( ! empty( $_REQUEST['post_type'] ) && 'spt_testimonial_form' == $_REQUEST['post_type'] && ! empty( $pagenow ) && 'edit.php' == $pagenow ) {
131
  header( 'Location: ' . get_admin_url( null, 'post-new.php?post_type=spt_testimonial_form' ) );
132
  exit;
133
  }
1
  <?php
2
+ /**
3
+ * Testimonial class file.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
+
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit; // Exit if accessed directly.
14
  }
57
  */
58
  public function spt_testimonial_form_admin_head() {
59
  $screen = get_current_screen();
60
+ if ( 'spt_testimonial_form' === $screen->post_type ) {
61
  ?><script>
62
  jQuery(document).ready(function(){
63
  jQuery("#submitdiv #publish, #submitdiv, #submitdiv #save-post").attr("disabled", true).css("opacity", "0.8");
85
  $labels = apply_filters(
86
  'sp_testimonial_post_type_labels',
87
  array(
88
+ /* translators: %s is replaced with 'member plural name' */
89
+ 'name' => wp_sprintf( __( 'All %s', 'testimonial-free' ), esc_html( $plural_name ) ),
90
  'singular_name' => $singular_name,
91
  'menu_name' => $singular_name,
92
+ /* translators: %s is replaced with 'member plural name' */
93
+ 'all_items' => wp_sprintf( __( 'All %s', 'testimonial-free' ), esc_html( $plural_name ) ),
94
  'add_new' => __( 'Add New', 'testimonial-free' ),
95
  'add_new_item' => __( 'Add New', 'testimonial-free' ),
96
  'edit' => __( 'Edit', 'testimonial-free' ),
97
+ /* translators: %s is replaced with 'member plural name' */
98
+ 'edit_item' => wp_sprintf( __( 'Edit %s', 'testimonial-free' ), esc_html( $singular_name ) ),
99
+ /* translators: %s is replaced with 'member plural name' */
100
+ 'new_item' => wp_sprintf( __( 'New %s', 'testimonial-free' ), esc_html( $singular_name ) ),
101
+ /* translators: %s is replaced with 'member plural name' */
102
+ 'search_items' => wp_sprintf( __( 'Search %s', 'testimonial-free' ), esc_html( $plural_name ) ),
103
+ /* translators: %s is replaced with 'member plural name' */
104
+ 'not_found' => wp_sprintf( __( 'No %s found', 'testimonial-free' ), esc_html( $plural_name ) ),
105
+ /* translators: %s is replaced with 'member plural name' */
106
+ 'not_found_in_trash' => wp_sprintf( __( 'No %s found in Trash', 'testimonial-free' ), esc_html( $plural_name ) ),
107
+ /* translators: %s is replaced with 'member plural name' */
108
+ 'parent' => wp_sprintf( __( 'Parent %s', 'testimonial-free' ), esc_html( $plural_name ) ),
109
+ /* translators: %s is replaced with 'member plural name' */
110
+ 'featured_image' => wp_sprintf( __( '%s Image', 'testimonial-free' ), esc_html( $singular_name ) ),
111
+ /* translators: %s is replaced with 'member plural name' */
112
+ 'set_featured_image' => wp_sprintf( __( 'Set %s image', 'testimonial-free' ), esc_html( $singular_name ) ),
113
  'remove_featured_image' => __( 'Remove image', 'testimonial-free' ),
114
  'use_featured_image' => __( 'Use as image', 'testimonial-free' ),
115
  )
119
  'sp_testimonial_post_type_args',
120
  array(
121
  'label' => $singular_name,
122
+ /* translators: %s is replaced with 'member plural name' */
123
+ 'description' => wp_sprintf( __( '%s custom post type.', 'testimonial-free' ), esc_html( $singular_name ) ),
124
  'taxonomies' => array(),
125
  'public' => false,
126
  'has_archive' => false,
146
  register_post_type( 'spt_testimonial', $args );
147
  }
148
 
149
+ /**
150
+ * Redirect function.
151
+ *
152
+ * @since 1.0
153
+ */
154
  public function sptfree_conditional_redirect_post_new() {
155
  global $_REQUEST,$pagenow;
156
+ if ( ! empty( $_REQUEST['post_type'] ) && 'spt_testimonial_form' === $_REQUEST['post_type'] && ! empty( $pagenow ) && 'edit.php' === $pagenow ) {
157
  header( 'Location: ' . get_admin_url( null, 'post-new.php?post_type=spt_testimonial_form' ) );
158
  exit;
159
  }
includes/class-testimonial-import-export.php CHANGED
@@ -1,7 +1,4 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit; // Exit if accessed directly.
4
- }
5
  /**
6
  * Custom import export.
7
  *
@@ -12,6 +9,10 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  * @subpackage Testimonial_free/includes.
13
  */
14
 
 
 
 
 
15
  /**
16
  * Custom import export.
17
  */
@@ -60,7 +61,7 @@ class Testimonial_Import_Export {
60
  }
61
  $export['metadata'] = array(
62
  'version' => SP_TFREE_VERSION,
63
- 'date' => date( 'Y/m/d' ),
64
  );
65
  }
66
  return $export;
@@ -73,10 +74,11 @@ class Testimonial_Import_Export {
73
  * @return void
74
  */
75
  public function export_shortcodes() {
76
- if ( ! wp_verify_nonce( $_POST['nonce'], 'spftestimonial_options_nonce' ) ) {
 
77
  die();
78
  }
79
- $shortcode_ids = isset( $_POST['lcp_ids'] ) ? $_POST['lcp_ids'] : '';
80
  $export = $this->export( $shortcode_ids );
81
 
82
  if ( is_wp_error( $export ) ) {
@@ -99,9 +101,9 @@ class Testimonial_Import_Export {
99
  /**
100
  * Insert an attachment from an URL address.
101
  *
102
- * @param String $url remote url.
103
- * @param Int $parent_post_id parent post id.
104
- * @return Int Attachment ID
105
  */
106
  public function insert_attachment_from_url( $url, $parent_post_id = null ) {
107
 
@@ -119,7 +121,7 @@ class Testimonial_Import_Export {
119
  }
120
  $http = new WP_Http();
121
  $response = $http->request( $url );
122
- if ( $response['response']['code'] != 200 ) {
123
  return false;
124
  }
125
  $upload = wp_upload_bits( basename( $url ), null, $response['body'] );
@@ -159,8 +161,9 @@ class Testimonial_Import_Export {
159
  /**
160
  * Import Testimonial ans shortcode.
161
  *
162
- * @param mixed $shortcodes Import Testimonials shortcode array.
163
  *
 
164
  * @return string
165
  */
166
  public function import( $shortcodes ) {
@@ -226,11 +229,12 @@ class Testimonial_Import_Export {
226
  * @return void
227
  */
228
  public function import_shortcodes() {
229
- if ( ! wp_verify_nonce( $_POST['nonce'], 'spftestimonial_options_nonce' ) ) {
 
230
  die();
231
  }
232
- $data = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : '';
233
- $data = json_decode( stripslashes( $data ) );
234
  $data = json_decode( $data, true );
235
  $shortcodes = $data['shortcode'];
236
  if ( ! $data ) {
1
  <?php
 
 
 
2
  /**
3
  * Custom import export.
4
  *
9
  * @subpackage Testimonial_free/includes.
10
  */
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit; // Exit if accessed directly.
14
+ }
15
+
16
  /**
17
  * Custom import export.
18
  */
61
  }
62
  $export['metadata'] = array(
63
  'version' => SP_TFREE_VERSION,
64
+ 'date' => gmdate( 'Y/m/d' ),
65
  );
66
  }
67
  return $export;
74
  * @return void
75
  */
76
  public function export_shortcodes() {
77
+ $nonce = ( ! empty( $_POST['nonce'] ) ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
78
+ if ( ! wp_verify_nonce( $nonce, 'spftestimonial_options_nonce' ) ) {
79
  die();
80
  }
81
+ $shortcode_ids = isset( $_POST['lcp_ids'] ) ? $_POST['lcp_ids'] : ''; // phpcs:ignore
82
  $export = $this->export( $shortcode_ids );
83
 
84
  if ( is_wp_error( $export ) ) {
101
  /**
102
  * Insert an attachment from an URL address.
103
  *
104
+ * @param string $url remote url.
105
+ * @param int $parent_post_id parent post id.
106
+ * @return int Attachment ID
107
  */
108
  public function insert_attachment_from_url( $url, $parent_post_id = null ) {
109
 
121
  }
122
  $http = new WP_Http();
123
  $response = $http->request( $url );
124
+ if ( 200 !== $response['response']['code'] ) {
125
  return false;
126
  }
127
  $upload = wp_upload_bits( basename( $url ), null, $response['body'] );
161
  /**
162
  * Import Testimonial ans shortcode.
163
  *
164
+ * @param array $shortcodes Import Testimonials shortcode array.
165
  *
166
+ * @throws \Exception Error message.
167
  * @return string
168
  */
169
  public function import( $shortcodes ) {
229
  * @return void
230
  */
231
  public function import_shortcodes() {
232
+ $nonce = ( ! empty( $_POST['nonce'] ) ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
233
+ if ( ! wp_verify_nonce( $nonce, 'spftestimonial_options_nonce' ) ) {
234
  die();
235
  }
236
+ $data = isset( $_POST['shortcode'] ) ? wp_kses_data( wp_unslash( $_POST['shortcode'] ) ) : '';
237
+ $data = json_decode( $data );
238
  $data = json_decode( $data, true );
239
  $shortcodes = $data['shortcode'];
240
  if ( ! $data ) {
includes/custom-css.php CHANGED
@@ -1,3 +1,13 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  $setting_options = get_option( 'sp_testimonial_pro_options' );
3
  $custom_css = $setting_options['custom_css'];
1
  <?php
2
+ /**
3
+ * Custom css file.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
+
12
  $setting_options = get_option( 'sp_testimonial_pro_options' );
13
  $custom_css = $setting_options['custom_css'];
includes/free/loader.php CHANGED
@@ -6,9 +6,17 @@
6
  *
7
  * @since 2.0
8
  */
9
- class SP_TFREE_Loader {
10
 
11
- function __construct() {
 
 
 
 
 
 
 
 
 
12
  require_once SP_TFREE_PATH . 'admin/views/scripts.php';
13
  require_once SP_TFREE_PATH . 'admin/views/mce-button.php';
14
  require_once SP_TFREE_PATH . 'admin/views/widget.php';
6
  *
7
  * @since 2.0
8
  */
 
9
 
10
+ /**
11
+ * Loader class.
12
+ */
13
+ class SP_TFREE_Loader {
14
+ /**
15
+ * Single constructor of the class.
16
+ *
17
+ * @since 2.0
18
+ */
19
+ public function __construct() {
20
  require_once SP_TFREE_PATH . 'admin/views/scripts.php';
21
  require_once SP_TFREE_PATH . 'admin/views/mce-button.php';
22
  require_once SP_TFREE_PATH . 'admin/views/widget.php';
includes/functions.php CHANGED
@@ -1,4 +1,14 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  } // if direct access
@@ -22,21 +32,23 @@ class SP_Testimonial_Free_Functions {
22
 
23
  /**
24
  * Post update messages for Shortcode Generator
 
 
25
  */
26
- function sp_tfree_change_default_post_update_message( $message ) {
27
  $screen = get_current_screen();
28
- if ( 'spt_shortcodes' == $screen->post_type ) {
29
- $message['post'][1] = $title = esc_html__( 'View updated.', 'testimonial-free' );
30
- $message['post'][4] = $title = esc_html__( 'View updated.', 'testimonial-free' );
31
- $message['post'][6] = $title = esc_html__( 'View published.', 'testimonial-free' );
32
- $message['post'][8] = $title = esc_html__( 'View submitted.', 'testimonial-free' );
33
- $message['post'][10] = $title = esc_html__( 'View draft updated.', 'testimonial-free' );
34
- } elseif ( 'spt_testimonial' == $screen->post_type ) {
35
- $message['post'][1] = $title = esc_html__( 'Testimonial updated.', 'testimonial-free' );
36
- $message['post'][4] = $title = esc_html__( 'Testimonial updated.', 'testimonial-free' );
37
- $message['post'][6] = $title = esc_html__( 'Testimonial published.', 'testimonial-free' );
38
- $message['post'][8] = $title = esc_html__( 'Testimonial submitted.', 'testimonial-free' );
39
- $message['post'][10] = $title = esc_html__( 'Testimonial draft updated.', 'testimonial-free' );
40
  }
41
 
42
  return $message;
@@ -45,20 +57,20 @@ class SP_Testimonial_Free_Functions {
45
  /**
46
  * Review Text
47
  *
48
- * @param $text
49
  *
50
  * @return string
51
  */
52
  public function admin_footer( $text ) {
53
  $screen = get_current_screen();
54
- if ( 'spt_testimonial' == get_post_type() || $screen->id == 'spt_testimonial_page_tfree_help' || $screen->post_type == 'spt_shortcodes' ) {
55
  $url = 'https://wordpress.org/support/plugin/testimonial-free/reviews/?filter=5#new-post';
56
  $text = sprintf(
57
- __( 'If you like <strong>Testimonial</strong> please leave us a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. Your Review is very important to us as it helps us to grow more. ', 'testimonial-free' ),
58
- $url
59
  );
60
  }
61
- if ( $screen->id == 'spt_testimonial_page_testimonial_premium' || $screen->id == 'spt_testimonial_page_tfree_help' ) {
62
  $text = '';
63
  add_filter( 'update_footer', '__return_empty_string', 11 );
64
  }
@@ -68,7 +80,7 @@ class SP_Testimonial_Free_Functions {
68
  /**
69
  * Admin Menu.
70
  */
71
- function admin_menu() {
72
  add_submenu_page(
73
  'edit.php?post_type=spt_testimonial',
74
  __( 'Testimonial Pro', 'testimonial-free' ),
@@ -96,9 +108,9 @@ class SP_Testimonial_Free_Functions {
96
  /**
97
  * Happy users.
98
  *
99
- * @param boolean $username
100
- * @param array $args
101
- * @return void
102
  */
103
  public function happy_users( $username = 'shapedplugin', $args = array() ) {
104
  if ( $username ) {
@@ -141,10 +153,10 @@ class SP_Testimonial_Free_Functions {
141
  <div class="row">
142
  <div class="sp_testimonial-col-xl-6">
143
  <div class="sp_testimonial-banner-content">
144
- <h2 class="sp_testimonial-font-30 main-color sp_testimonial-font-weight-500"><?php _e( 'Upgrade To Testimonial Pro', 'testimonial-free' ); ?></h2>
145
- <h4 class="sp_testimonial-mt-10 sp_testimonial-font-18 sp_testimonial-font-weight-500"><?php _e( 'Supercharge <strong>Testimonial</strong> with powerful functionality!', 'testimonial-free' ); ?></h4>
146
- <p class="sp_testimonial-mt-25 text-color-2 line-height-20 sp_testimonial-font-weight-400"><?php _e( 'Easily collect, manage, and display testimonials reviews, or quotes in multiple ways on any page on your WordPress site. The plugin comes with the easiest Shortcode Generator settings panel that can help you build awesome and unique testimonials showcase with responsive layouts and customized styles.', 'testimonial-free' ); ?></p>
147
- <p class="sp_testimonial-mt-20 text-color-2 sp_testimonial-line-height-20 sp_testimonial-font-weight-400"><?php _e( 'Create unlimited Testimonial Collection Forms with our drag-and-drop form builder. Use our smartly designed testimonial form to collect detailed feedback from your customers.', 'testimonial-free' ); ?></p>
148
  </div>
149
  <div class="sp_testimonial-banner-button sp_testimonial-mt-40">
150
  <a class="sp_testimonial-btn sp_testimonial-btn-sky" href="https://shapedplugin.com/plugin/testimonial-pro/?ref=1" target="_blank">Upgrade To Testimonial Pro Now</a>
@@ -153,7 +165,7 @@ class SP_Testimonial_Free_Functions {
153
  </div>
154
  <div class="sp_testimonial-col-xl-6">
155
  <div class="sp_testimonial-banner-img">
156
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-3.svg'; ?>" alt="">
157
  </div>
158
  </div>
159
  </div>
@@ -208,7 +220,7 @@ class SP_Testimonial_Free_Functions {
208
  <h4 class="sp_testimonial-font-16 sp_testimonial-mt-10 sp_testimonial-font-weight-400">Make customers 70% more probable to purchase with testimonials that drive sales</h4>
209
  </div>
210
  <div class="video-area text-center">
211
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-1.svg'; ?>" alt="">
212
  <div class="video-button">
213
  <a class="js-video-button" href="#" data-channel="youtube" data-video-url="//www.youtube.com/embed/-eTeFR-_VoE">
214
  <span><i class="fa fa-play"></i></span>
@@ -230,7 +242,7 @@ class SP_Testimonial_Free_Functions {
230
  <div class="feature-area">
231
  <div class="feature-item mr-30">
232
  <div class="feature-icon">
233
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/layouts.svg'; ?>" alt="">
234
  </div>
235
  <div class="feature-content">
236
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">5+ Beautiful Layouts</h3>
@@ -240,7 +252,7 @@ class SP_Testimonial_Free_Functions {
240
  <div class="feature-item ml-30">
241
  <div class="feature-icon">
242
  <img src="
243
- <?php echo SP_TFREE_URL . '/admin/assets/images/premium/themes.svg'; ?>
244
  " alt="">
245
  </div>
246
  <div class="feature-content">
@@ -252,7 +264,7 @@ class SP_Testimonial_Free_Functions {
252
  <div class="feature-area">
253
  <div class="feature-item mr-30">
254
  <div class="feature-icon">
255
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/filter.svg'; ?>" alt="">
256
  </div>
257
  <div class="feature-content">
258
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Filter Testimonials (Groups, Specific, Exclude)</h3>
@@ -261,7 +273,7 @@ class SP_Testimonial_Free_Functions {
261
  </div>
262
  <div class="feature-item ml-30">
263
  <div class="feature-icon">
264
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/display-options.svg'; ?>" alt="">
265
  </div>
266
  <div class="feature-content">
267
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">14 Display Options (Information Fields)</h3>
@@ -272,7 +284,7 @@ class SP_Testimonial_Free_Functions {
272
  <div class="feature-area">
273
  <div class="feature-item mr-30">
274
  <div class="feature-icon">
275
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/submission-forms.svg'; ?>" alt="">
276
  </div>
277
  <div class="feature-content">
278
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Multiple Testimonials Submission Forms</h3>
@@ -281,7 +293,7 @@ class SP_Testimonial_Free_Functions {
281
  </div>
282
  <div class="feature-item ml-30">
283
  <div class="feature-icon">
284
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/drag-and-drop.svg'; ?>" alt="">
285
  </div>
286
  <div class="feature-content">
287
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Drag & Drop Submission Forms Fields</h3>
@@ -292,7 +304,7 @@ class SP_Testimonial_Free_Functions {
292
  <div class="feature-area">
293
  <div class="feature-item mr-30">
294
  <div class="feature-icon">
295
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/thumbnail-slider.svg'; ?>" alt="">
296
  </div>
297
  <div class="feature-content">
298
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Thumbnail Testimonial Slider</h3>
@@ -301,7 +313,7 @@ class SP_Testimonial_Free_Functions {
301
  </div>
302
  <div class="feature-item ml-30">
303
  <div class="feature-icon">
304
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/video-testimonial.svg'; ?>" alt="">
305
  </div>
306
  <div class="feature-content">
307
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Video Testimonial with Lightbox</h3>
@@ -312,7 +324,7 @@ class SP_Testimonial_Free_Functions {
312
  <div class="feature-area">
313
  <div class="feature-item mr-30">
314
  <div class="feature-icon">
315
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/read-more.svg'; ?>" alt="">
316
  </div>
317
  <div class="feature-content">
318
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Read More Action Type (Expand/PopUp)</h3>
@@ -321,7 +333,7 @@ class SP_Testimonial_Free_Functions {
321
  </div>
322
  <div class="feature-item ml-30">
323
  <div class="feature-icon">
324
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/rich-snippets.svg'; ?>" alt="">
325
  </div>
326
  <div class="feature-content">
327
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Rich Snippets/Structured Data Compatible</h3>
@@ -332,7 +344,7 @@ class SP_Testimonial_Free_Functions {
332
  <div class="feature-area">
333
  <div class="feature-item mr-30">
334
  <div class="feature-icon">
335
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/ajax-pagination.svg'; ?>" alt="">
336
  </div>
337
  <div class="feature-content">
338
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Ajax Pagination</h3>
@@ -342,7 +354,7 @@ class SP_Testimonial_Free_Functions {
342
  </div>
343
  <div class="feature-item ml-30">
344
  <div class="feature-icon">
345
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/translation-ready.svg'; ?>" alt="">
346
  </div>
347
  <div class="feature-content">
348
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Translation Ready with WPML</h3>
@@ -353,7 +365,7 @@ class SP_Testimonial_Free_Functions {
353
  <div class="feature-area">
354
  <div class="feature-item mr-30">
355
  <div class="feature-icon">
356
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/automatic-updates.svg'; ?>" alt="">
357
  </div>
358
  <div class="feature-content">
359
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Built-in Automatic Updates</h3>
@@ -362,7 +374,7 @@ class SP_Testimonial_Free_Functions {
362
  </div>
363
  <div class="feature-item ml-30">
364
  <div class="feature-icon">
365
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/support.svg'; ?>" alt="">
366
  </div>
367
  <div class="feature-content">
368
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Fast & Friendly Support (One to One)</h3>
@@ -381,7 +393,7 @@ class SP_Testimonial_Free_Functions {
381
  <div class="row">
382
  <div class="sp_testimonial-col-xl-6">
383
  <div class="buy-img">
384
- <img src="<?php echo SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-2.svg'; ?>" alt="">
385
  </div>
386
  </div>
387
  <div class="sp_testimonial-col-xl-6">
@@ -423,8 +435,8 @@ class SP_Testimonial_Free_Functions {
423
  <div class="header-area">
424
  <div class="container">
425
  <div class="header-logo">
426
- <img src="<?php echo SP_TFREE_URL . 'admin/assets/images/testimonial-logo-2.svg'; ?>" alt="">
427
- <span><?php echo SP_TFREE_VERSION; ?></span>
428
  </div>
429
  <div class="header-content">
430
 
@@ -453,63 +465,82 @@ class SP_Testimonial_Free_Functions {
453
  <div class="upgrade-area">
454
  <h2>Upgrade To Testimonial Pro</h2>
455
  <p>Easily collect and display testimonials on your website and boost conversions.</p>
456
- <div class="upgrade-img"><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/header-img.svg'; ?>" alt=""></div>
457
  </div>
458
  <div class="upgrade-info">
459
  <div class="container">
460
  <div class="row">
461
  <div class="col-lg-6">
462
  <ul class="upgrade-list">
463
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
464
  5+ Beautiful Testimonial Layouts.
465
- </li>
466
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
467
- 10+ Customizable & Professionally Designed Themes.</li>
468
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
469
- Advanced Shortcode Generator with Query options.</li>
470
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">Thumbnail Testimonials Slider.</li>
471
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""> Advanced Typography and Styling options.</li>
472
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""> Display Group or Specific Testimonials.</li>
473
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""> Isotope Filtering Testimonials by Categories.</li>
474
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
475
- Video Testimonials for lightbox functionality.</li>
476
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">Create Multiple Testimonial Submission Forms.</li>
477
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
478
- Drag & drop Testimonial Form Builder.</li>
479
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""> Testimonial Pending in Dashboard for approval.</li>
480
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""> Site Admin can manage the Testimonials before publishing.</li>
481
  </ul>
482
  </div>
483
  <div class="col-lg-6">
484
  <ul class="upgrade-list">
485
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
486
- Testimonial Form Spam Protection with Google reCAPTCHA.</li>
487
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
488
- Multiple Testimonial Rows in the Carousel.</li>
489
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
490
- Rich Snippets/Structured Data compatible (Schema Markup).</li>
491
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
492
-
493
- Ajax Pagination (Number, Load More, & Infinite Scroll).</li>
494
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
495
-
496
- 14 Display (Reviewer Information) Options.</li>
497
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
498
-
499
- Read More & Characters Limit.</li>
500
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
501
-
502
- Read More Action Type (Expand/PopUp).</li>
503
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
504
- 20+ Slider Control Options.</li>
505
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
506
- Fully Translation ready with WPML, Polylang and more.</li>
507
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
508
- Built-in Automatic Updates.</li>
509
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt="">
510
- One To One Fast & Friendly Support.</li>
511
- <li><img src="<?php echo SP_TFREE_URL . 'admin/assets/images/checkmark.svg'; ?>" alt=""><span>
512
- Not Happy? 100% No Questions Asked <a href="https://shapedplugin.com/refund-policy/" target="_blank">Refund Policy!</a></span></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  </ul>
514
  </div>
515
  </div>
@@ -519,7 +550,7 @@ Not Happy? 100% No Questions Asked <a href="https://shapedplugin.com/refund-poli
519
  <div class="upgrade-pro">
520
  <div class="pro-content">
521
  <div class="pro-icon">
522
- <img src="<?php echo SP_TFREE_URL . 'admin/assets/images/Testimonial-icon.svg'; ?>" alt="">
523
  </div>
524
  <div class="pro-text">
525
  <h2>Testimonial Pro</h2>
@@ -544,7 +575,7 @@ Not Happy? 100% No Questions Asked <a href="https://shapedplugin.com/refund-poli
544
  </div>
545
  <div class="testimonial-info">
546
  <div class="img">
547
- <img src="<?php echo SP_TFREE_URL . 'admin/assets/images/sirpa.png'; ?>" alt="">
548
  </div>
549
  <div class="info">
550
  <h3>Sirpa</h3>
@@ -562,7 +593,7 @@ Not Happy? 100% No Questions Asked <a href="https://shapedplugin.com/refund-poli
562
  </div>
563
  <div class="testimonial-info">
564
  <div class="img">
565
- <img src="<?php echo SP_TFREE_URL . 'admin/assets/images/ali_senejani.png'; ?>" alt="">
566
  </div>
567
  <div class="info">
568
  <h3>Ali Senejani</h3>
@@ -592,12 +623,15 @@ new SP_Testimonial_Free_Functions();
592
  *
593
  * @since 2.0
594
  */
595
-
596
- // Polylang plugin support for multi language support.
597
  if ( class_exists( 'Polylang' ) ) {
598
 
599
  add_filter( 'pll_get_post_types', 'sp_free_testimonial_polylang', 10, 2 );
600
-
 
 
 
 
 
601
  function sp_free_testimonial_polylang( $post_types, $is_settings ) {
602
  if ( $is_settings ) {
603
  // hides 'spt_testimonial,spt_shortcodes' from the list of custom post types in Polylang settings.
1
  <?php
2
+ /**
3
+ * Functions file.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
+
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  } // if direct access
32
 
33
  /**
34
  * Post update messages for Shortcode Generator
35
+ *
36
+ * @param string $message post update message.
37
  */
38
+ public function sp_tfree_change_default_post_update_message( $message ) {
39
  $screen = get_current_screen();
40
+ if ( 'spt_shortcodes' === $screen->post_type ) {
41
+ $message['post'][1] = esc_html__( 'View updated.', 'testimonial-free' );
42
+ $message['post'][4] = esc_html__( 'View updated.', 'testimonial-free' );
43
+ $message['post'][6] = esc_html__( 'View published.', 'testimonial-free' );
44
+ $message['post'][8] = esc_html__( 'View submitted.', 'testimonial-free' );
45
+ $message['post'][10] = esc_html__( 'View draft updated.', 'testimonial-free' );
46
+ } elseif ( 'spt_testimonial' === $screen->post_type ) {
47
+ $message['post'][1] = esc_html__( 'Testimonial updated.', 'testimonial-free' );
48
+ $message['post'][4] = esc_html__( 'Testimonial updated.', 'testimonial-free' );
49
+ $message['post'][6] = esc_html__( 'Testimonial published.', 'testimonial-free' );
50
+ $message['post'][8] = esc_html__( 'Testimonial submitted.', 'testimonial-free' );
51
+ $message['post'][10] = esc_html__( 'Testimonial draft updated.', 'testimonial-free' );
52
  }
53
 
54
  return $message;
57
  /**
58
  * Review Text
59
  *
60
+ * @param string $text Footer review text.
61
  *
62
  * @return string
63
  */
64
  public function admin_footer( $text ) {
65
  $screen = get_current_screen();
66
+ if ( 'spt_testimonial' === get_post_type() || 'spt_testimonial_page_tfree_help' === $screen->id || 'spt_shortcodes' === $screen->post_type ) {
67
  $url = 'https://wordpress.org/support/plugin/testimonial-free/reviews/?filter=5#new-post';
68
  $text = sprintf(
69
+ wp_kses_post( 'If you like <strong>Testimonial</strong> please leave us a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. Your Review is very important to us as it helps us to grow more. ' ),
70
+ esc_url( $url )
71
  );
72
  }
73
+ if ( 'spt_testimonial_page_testimonial_premium' === $screen->id || 'spt_testimonial_page_tfree_help' === $screen->id ) {
74
  $text = '';
75
  add_filter( 'update_footer', '__return_empty_string', 11 );
76
  }
80
  /**
81
  * Admin Menu.
82
  */
83
+ public function admin_menu() {
84
  add_submenu_page(
85
  'edit.php?post_type=spt_testimonial',
86
  __( 'Testimonial Pro', 'testimonial-free' ),
108
  /**
109
  * Happy users.
110
  *
111
+ * @param string $username Happy users.
112
+ * @param array $args Happy users args.
113
+ * @return array
114
  */
115
  public function happy_users( $username = 'shapedplugin', $args = array() ) {
116
  if ( $username ) {
153
  <div class="row">
154
  <div class="sp_testimonial-col-xl-6">
155
  <div class="sp_testimonial-banner-content">
156
+ <h2 class="sp_testimonial-font-30 main-color sp_testimonial-font-weight-500"><?php esc_html_e( 'Upgrade To Testimonial Pro', 'testimonial-free' ); ?></h2>
157
+ <h4 class="sp_testimonial-mt-10 sp_testimonial-font-18 sp_testimonial-font-weight-500"><?php echo wp_kses_post( 'Supercharge <strong>Testimonial</strong> with powerful functionality!' ); ?></h4>
158
+ <p class="sp_testimonial-mt-25 text-color-2 line-height-20 sp_testimonial-font-weight-400"><?php esc_html_e( 'Easily collect, manage, and display testimonials reviews, or quotes in multiple ways on any page on your WordPress site. The plugin comes with the easiest Shortcode Generator settings panel that can help you build awesome and unique testimonials showcase with responsive layouts and customized styles.', 'testimonial-free' ); ?></p>
159
+ <p class="sp_testimonial-mt-20 text-color-2 sp_testimonial-line-height-20 sp_testimonial-font-weight-400"><?php esc_html_e( 'Create unlimited Testimonial Collection Forms with our drag-and-drop form builder. Use our smartly designed testimonial form to collect detailed feedback from your customers.', 'testimonial-free' ); ?></p>
160
  </div>
161
  <div class="sp_testimonial-banner-button sp_testimonial-mt-40">
162
  <a class="sp_testimonial-btn sp_testimonial-btn-sky" href="https://shapedplugin.com/plugin/testimonial-pro/?ref=1" target="_blank">Upgrade To Testimonial Pro Now</a>
165
  </div>
166
  <div class="sp_testimonial-col-xl-6">
167
  <div class="sp_testimonial-banner-img">
168
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-3.svg' ); ?>" alt="">
169
  </div>
170
  </div>
171
  </div>
220
  <h4 class="sp_testimonial-font-16 sp_testimonial-mt-10 sp_testimonial-font-weight-400">Make customers 70% more probable to purchase with testimonials that drive sales</h4>
221
  </div>
222
  <div class="video-area text-center">
223
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-1.svg' ); ?>" alt="">
224
  <div class="video-button">
225
  <a class="js-video-button" href="#" data-channel="youtube" data-video-url="//www.youtube.com/embed/-eTeFR-_VoE">
226
  <span><i class="fa fa-play"></i></span>
242
  <div class="feature-area">
243
  <div class="feature-item mr-30">
244
  <div class="feature-icon">
245
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/layouts.svg' ); ?>" alt="">
246
  </div>
247
  <div class="feature-content">
248
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">5+ Beautiful Layouts</h3>
252
  <div class="feature-item ml-30">
253
  <div class="feature-icon">
254
  <img src="
255
+ <?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/themes.svg' ); ?>
256
  " alt="">
257
  </div>
258
  <div class="feature-content">
264
  <div class="feature-area">
265
  <div class="feature-item mr-30">
266
  <div class="feature-icon">
267
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/filter.svg' ); ?>" alt="">
268
  </div>
269
  <div class="feature-content">
270
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Filter Testimonials (Groups, Specific, Exclude)</h3>
273
  </div>
274
  <div class="feature-item ml-30">
275
  <div class="feature-icon">
276
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/display-options.svg' ); ?>" alt="">
277
  </div>
278
  <div class="feature-content">
279
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">14 Display Options (Information Fields)</h3>
284
  <div class="feature-area">
285
  <div class="feature-item mr-30">
286
  <div class="feature-icon">
287
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/submission-forms.svg' ); ?>" alt="">
288
  </div>
289
  <div class="feature-content">
290
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Multiple Testimonials Submission Forms</h3>
293
  </div>
294
  <div class="feature-item ml-30">
295
  <div class="feature-icon">
296
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/drag-and-drop.svg' ); ?>" alt="">
297
  </div>
298
  <div class="feature-content">
299
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Drag & Drop Submission Forms Fields</h3>
304
  <div class="feature-area">
305
  <div class="feature-item mr-30">
306
  <div class="feature-icon">
307
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/thumbnail-slider.svg' ); ?>" alt="">
308
  </div>
309
  <div class="feature-content">
310
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Thumbnail Testimonial Slider</h3>
313
  </div>
314
  <div class="feature-item ml-30">
315
  <div class="feature-icon">
316
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/video-testimonial.svg' ); ?>" alt="">
317
  </div>
318
  <div class="feature-content">
319
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Video Testimonial with Lightbox</h3>
324
  <div class="feature-area">
325
  <div class="feature-item mr-30">
326
  <div class="feature-icon">
327
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/read-more.svg' ); ?>" alt="">
328
  </div>
329
  <div class="feature-content">
330
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Read More Action Type (Expand/PopUp)</h3>
333
  </div>
334
  <div class="feature-item ml-30">
335
  <div class="feature-icon">
336
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/rich-snippets.svg' ); ?>" alt="">
337
  </div>
338
  <div class="feature-content">
339
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Rich Snippets/Structured Data Compatible</h3>
344
  <div class="feature-area">
345
  <div class="feature-item mr-30">
346
  <div class="feature-icon">
347
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/ajax-pagination.svg' ); ?>" alt="">
348
  </div>
349
  <div class="feature-content">
350
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Ajax Pagination</h3>
354
  </div>
355
  <div class="feature-item ml-30">
356
  <div class="feature-icon">
357
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/translation-ready.svg' ); ?>" alt="">
358
  </div>
359
  <div class="feature-content">
360
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Translation Ready with WPML</h3>
365
  <div class="feature-area">
366
  <div class="feature-item mr-30">
367
  <div class="feature-icon">
368
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/automatic-updates.svg' ); ?>" alt="">
369
  </div>
370
  <div class="feature-content">
371
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Built-in Automatic Updates</h3>
374
  </div>
375
  <div class="feature-item ml-30">
376
  <div class="feature-icon">
377
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/support.svg' ); ?>" alt="">
378
  </div>
379
  <div class="feature-content">
380
  <h3 class="sp_testimonial-font-18 sp_testimonial-font-weight-600">Fast & Friendly Support (One to One)</h3>
393
  <div class="row">
394
  <div class="sp_testimonial-col-xl-6">
395
  <div class="buy-img">
396
+ <img src="<?php echo esc_url( SP_TFREE_URL . '/admin/assets/images/premium/premium-vector-2.svg' ); ?>" alt="">
397
  </div>
398
  </div>
399
  <div class="sp_testimonial-col-xl-6">
435
  <div class="header-area">
436
  <div class="container">
437
  <div class="header-logo">
438
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/testimonial-logo-2.svg' ); ?>" alt="">
439
+ <span><?php echo esc_html( SP_TFREE_VERSION ); ?></span>
440
  </div>
441
  <div class="header-content">
442
 
465
  <div class="upgrade-area">
466
  <h2>Upgrade To Testimonial Pro</h2>
467
  <p>Easily collect and display testimonials on your website and boost conversions.</p>
468
+ <div class="upgrade-img"><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/header-img.svg' ); ?>" alt=""></div>
469
  </div>
470
  <div class="upgrade-info">
471
  <div class="container">
472
  <div class="row">
473
  <div class="col-lg-6">
474
  <ul class="upgrade-list">
475
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
476
  5+ Beautiful Testimonial Layouts.
477
+ </li>
478
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
479
+ 10+ Customizable & Professionally Designed Themes.</li>
480
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
481
+ Advanced Shortcode Generator with Query options.</li>
482
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">Thumbnail Testimonials Slider.</li>
483
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""> Advanced Typography and Styling options.</li>
484
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""> Display Group or Specific Testimonials.</li>
485
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""> Isotope Filtering Testimonials by Categories.</li>
486
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
487
+ Video Testimonials for lightbox functionality.</li>
488
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">Create Multiple Testimonial Submission Forms.</li>
489
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
490
+ Drag & drop Testimonial Form Builder.</li>
491
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""> Testimonial Pending in Dashboard for approval.</li>
492
+ <li><img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""> Site Admin can manage the Testimonials before publishing.</li>
493
  </ul>
494
  </div>
495
  <div class="col-lg-6">
496
  <ul class="upgrade-list">
497
+ <li>
498
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
499
+ Testimonial Form Spam Protection with Google reCAPTCHA.
500
+ </li>
501
+ <li>
502
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
503
+ Multiple Testimonial Rows in the Carousel.
504
+ </li>
505
+ <li>
506
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
507
+ Rich Snippets/Structured Data compatible (Schema Markup).
508
+ </li>
509
+ <li>
510
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
511
+ Ajax Pagination (Number, Load More, & Infinite Scroll).
512
+ </li>
513
+ <li>
514
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
515
+ 14 Display (Reviewer Information) Options.
516
+ </li>
517
+ <li>
518
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
519
+ Read More & Characters Limit.
520
+ </li>
521
+ <li>
522
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
523
+ Read More Action Type (Expand/PopUp).
524
+ </li>
525
+ <li>
526
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
527
+ 20+ Slider Control Options.
528
+ </li>
529
+ <li>
530
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
531
+ Fully Translation ready with WPML, Polylang and more.
532
+ </li>
533
+ <li>
534
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
535
+ Built-in Automatic Updates.</li>
536
+ <li>
537
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt="">
538
+ One To One Fast & Friendly Support.
539
+ </li>
540
+ <li>
541
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/checkmark.svg' ); ?>" alt=""><span>
542
+ Not Happy? 100% No Questions Asked <a href="https://shapedplugin.com/refund-policy/" target="_blank">Refund Policy!</a></span>
543
+ </li>
544
  </ul>
545
  </div>
546
  </div>
550
  <div class="upgrade-pro">
551
  <div class="pro-content">
552
  <div class="pro-icon">
553
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/Testimonial-icon.svg' ); ?>" alt="">
554
  </div>
555
  <div class="pro-text">
556
  <h2>Testimonial Pro</h2>
575
  </div>
576
  <div class="testimonial-info">
577
  <div class="img">
578
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/sirpa.png' ); ?>" alt="">
579
  </div>
580
  <div class="info">
581
  <h3>Sirpa</h3>
593
  </div>
594
  <div class="testimonial-info">
595
  <div class="img">
596
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'admin/assets/images/ali_senejani.png' ); ?>" alt="">
597
  </div>
598
  <div class="info">
599
  <h3>Ali Senejani</h3>
623
  *
624
  * @since 2.0
625
  */
 
 
626
  if ( class_exists( 'Polylang' ) ) {
627
 
628
  add_filter( 'pll_get_post_types', 'sp_free_testimonial_polylang', 10, 2 );
629
+ /**
630
+ * Polylang plugin support for multi language support.
631
+ *
632
+ * @param array $post_types Post type.
633
+ * @param boolean $is_settings Polylang settings true/false.
634
+ */
635
  function sp_free_testimonial_polylang( $post_types, $is_settings ) {
636
  if ( $is_settings ) {
637
  // hides 'spt_testimonial,spt_shortcodes' from the list of custom post types in Polylang settings.
public/views/deprecated-shortcodes.php CHANGED
@@ -1,10 +1,25 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  } // Exit if accessed directly.
5
 
6
- // Testimonial Free shortcode.
 
 
 
 
7
  function sp_testimonial_free_shortcode( $atts ) {
 
8
  extract(
9
  shortcode_atts(
10
  array(
@@ -12,7 +27,9 @@ function sp_testimonial_free_shortcode( $atts ) {
12
  'nav' => 'true',
13
  'pagination' => 'true',
14
  'autoplay' => 'true',
15
- ), $atts, 'testimonial-free'
 
 
16
  )
17
  );
18
 
@@ -46,8 +63,7 @@ function sp_testimonial_free_shortcode( $atts ) {
46
 
47
  });
48
  </script>';
49
-
50
- if ( $nav == 'false' ) {
51
  echo "<style type='text/css'>
52
  .sp-testimonial-section .testimonial-free{
53
  margin: 0;
@@ -87,7 +103,7 @@ function sp_testimonial_free_shortcode( $atts ) {
87
  $outline .= apply_filters( 'the_content', get_the_content() );
88
  $outline .= '</div>';
89
  $outline .= '<h2 class="tf-client-name">';
90
- if ( isset( $testimonial_data['tpro_name'] ) && $testimonial_data['tpro_name'] !== '' ) {
91
  $outline .= $testimonial_data['tpro_name'];
92
  } else {
93
  $outline .= get_the_title();
@@ -95,7 +111,7 @@ function sp_testimonial_free_shortcode( $atts ) {
95
  $outline .= '</h2>';
96
  if ( isset( $testimonial_data['tpro_designation'] ) || $tf_designation ) {
97
  $outline .= '<h6 class="tf-client-designation">';
98
- if ( isset( $tf_designation ) && $tf_designation !== '' ) {
99
  $outline .= $tf_designation;
100
  } elseif ( isset( $testimonial_data['tpro_designation'] ) ) {
101
  $outline .= $testimonial_data['tpro_designation'];
1
  <?php
2
+ /**
3
+ * Old shortcode file.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
+
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  } // Exit if accessed directly.
15
 
16
+ /**
17
+ * Testimonial Free shortcode.
18
+ *
19
+ * @param array $atts shortcode attributes.
20
+ */
21
  function sp_testimonial_free_shortcode( $atts ) {
22
+ // phpcs:ignore
23
  extract(
24
  shortcode_atts(
25
  array(
27
  'nav' => 'true',
28
  'pagination' => 'true',
29
  'autoplay' => 'true',
30
+ ),
31
+ $atts,
32
+ 'testimonial-free'
33
  )
34
  );
35
 
63
 
64
  });
65
  </script>';
66
+ if ( 'false' === $nav ) {
 
67
  echo "<style type='text/css'>
68
  .sp-testimonial-section .testimonial-free{
69
  margin: 0;
103
  $outline .= apply_filters( 'the_content', get_the_content() );
104
  $outline .= '</div>';
105
  $outline .= '<h2 class="tf-client-name">';
106
+ if ( isset( $testimonial_data['tpro_name'] ) && '' !== $testimonial_data['tpro_name'] ) {
107
  $outline .= $testimonial_data['tpro_name'];
108
  } else {
109
  $outline .= get_the_title();
111
  $outline .= '</h2>';
112
  if ( isset( $testimonial_data['tpro_designation'] ) || $tf_designation ) {
113
  $outline .= '<h6 class="tf-client-designation">';
114
+ if ( isset( $tf_designation ) && '' !== $tf_designation ) {
115
  $outline .= $tf_designation;
116
  } elseif ( isset( $testimonial_data['tpro_designation'] ) ) {
117
  $outline .= $testimonial_data['tpro_designation'];
public/views/schema.php CHANGED
@@ -1,4 +1,14 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
  if ( $post_query->have_posts() ) {
3
  $sc_title = get_the_title( $post_id ) ? get_the_title( $post_id ) : 'Testimonial';
4
  $outline .= '<script type="application/ld+json">
1
  <?php
2
+ /**
3
+ * Schema file.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/views.
10
+ */
11
+
12
  if ( $post_query->have_posts() ) {
13
  $sc_title = get_the_title( $post_id ) ? get_the_title( $post_id ) : 'Testimonial';
14
  $outline .= '<script type="application/ld+json">
public/views/scripts.php CHANGED
@@ -1,4 +1,13 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit; } // if direct access
@@ -9,12 +18,16 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  class SP_TFREE_Front_Scripts {
10
 
11
  /**
 
 
12
  * @var null
13
  * @since 1.0
14
  */
15
  protected static $_instance = null;
16
 
17
  /**
 
 
18
  * @return SP_TFREE_Front_Scripts
19
  * @since 1.0
20
  */
@@ -37,7 +50,7 @@ class SP_TFREE_Front_Scripts {
37
  /**
38
  * Plugin Scripts and Styles
39
  */
40
- function front_scripts() {
41
  $setting_options = get_option( 'sp_testimonial_pro_options' );
42
  $dequeue_slick_css = isset( $setting_options['tf_dequeue_slick_css'] ) ? $setting_options['tf_dequeue_slick_css'] : true;
43
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
1
  <?php
2
+ /**
3
+ * Enqueue Scripts and styles files.
4
+ *
5
+ * @link http://shapedplugin.com
6
+ * @since 2.0.0
7
+ *
8
+ * @package Testimonial_free.
9
+ * @subpackage Testimonial_free/includes.
10
+ */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit; } // if direct access
18
  class SP_TFREE_Front_Scripts {
19
 
20
  /**
21
+ * Single instance of the class.
22
+ *
23
  * @var null
24
  * @since 1.0
25
  */
26
  protected static $_instance = null;
27
 
28
  /**
29
+ * SP_TFREE_Front_Scripts Instance.
30
+ *
31
  * @return SP_TFREE_Front_Scripts
32
  * @since 1.0
33
  */
50
  /**
51
  * Plugin Scripts and Styles
52
  */
53
+ public function front_scripts() {
54
  $setting_options = get_option( 'sp_testimonial_pro_options' );
55
  $dequeue_slick_css = isset( $setting_options['tf_dequeue_slick_css'] ) ? $setting_options['tf_dequeue_slick_css'] : true;
56
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
public/views/shortcoderender.php CHANGED
@@ -4,31 +4,47 @@
4
  *
5
  * @package testimonial-free
6
  */
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit; // Exit if accessed directly.
9
  }
10
 
11
- /**
12
- * Testimonial - Shortcode Render class
13
- *
14
- * @since 2.0
15
- */
16
  if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
 
 
 
 
 
17
  class TFREE_Shortcode_Render {
18
 
19
- public $tfree_five_star = '<i class="fa fa-star" aria-hidden="true"></i>
 
 
 
 
 
20
  <i class="fa fa-star" aria-hidden="true"></i>
21
  <i class="fa fa-star" aria-hidden="true"></i>
22
  <i class="fa fa-star" aria-hidden="true"></i>
23
  <i class="fa fa-star" aria-hidden="true"></i>
24
  ';
25
- public $tfree_four_star = '
 
 
 
 
 
26
  <i class="fa fa-star" aria-hidden="true"></i>
27
  <i class="fa fa-star" aria-hidden="true"></i>
28
  <i class="fa fa-star" aria-hidden="true"></i>
29
  <i class="fa fa-star" aria-hidden="true"></i>
30
  <i class="fa fa-star-o" aria-hidden="true"></i>
31
  ';
 
 
 
 
 
32
  public $tfree_three_star = '
33
  <i class="fa fa-star" aria-hidden="true"></i>
34
  <i class="fa fa-star" aria-hidden="true"></i>
@@ -36,14 +52,24 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
36
  <i class="fa fa-star-o" aria-hidden="true"></i>
37
  <i class="fa fa-star-o" aria-hidden="true"></i>
38
  ';
39
- public $tfree_two_star = '
 
 
 
 
 
40
  <i class="fa fa-star" aria-hidden="true"></i>
41
  <i class="fa fa-star" aria-hidden="true"></i>
42
  <i class="fa fa-star-o" aria-hidden="true"></i>
43
  <i class="fa fa-star-o" aria-hidden="true"></i>
44
  <i class="fa fa-star-o" aria-hidden="true"></i>
45
  ';
46
- public $tfree_one_star = '
 
 
 
 
 
47
  <i class="fa fa-star" aria-hidden="true"></i>
48
  <i class="fa fa-star-o" aria-hidden="true"></i>
49
  <i class="fa fa-star-o" aria-hidden="true"></i>
@@ -52,8 +78,9 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
52
  ';
53
 
54
  /**
55
- * @var TFREE_Shortcode_Render single instance of the class
56
  *
 
57
  * @since 2.0
58
  */
59
  protected static $_instance = null;
@@ -82,7 +109,9 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
82
  }
83
 
84
  /**
85
- * @param $attributes
 
 
86
  *
87
  * @return string
88
  * @since 2.0
@@ -183,7 +212,7 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
183
  $swipe_to_slide = isset( $shortcode_data['swipe_to_slide'] ) && $shortcode_data['swipe_to_slide'] ? 'true' : 'false';
184
  $slider_draggable = isset( $shortcode_data['slider_draggable'] ) && $shortcode_data['slider_draggable'] ? 'true' : 'false';
185
  $slider_direction = isset( $shortcode_data['slider_direction'] ) ? $shortcode_data['slider_direction'] : 'ltr';
186
- $rtl_mode = ( 'rtl' == $slider_direction ) ? 'true' : 'false';
187
 
188
  // Display Settings.
189
  $section_title = isset( $shortcode_data['section_title'] ) ? $shortcode_data['section_title'] : '';
@@ -245,7 +274,7 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
245
  color: ' . $navigation_hover_color . ';
246
  }
247
  ';
248
- if ( 'true' == $navigation ) {
249
  $outline .= '#sp-testimonial-free-wrapper-' . $post_id . ' .sp-testimonial-free-section{
250
  padding: 0 50px;
251
  }';
@@ -342,11 +371,11 @@ if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
342
  } else {
343
  $outline .= '<h2 class="sp-not-testimonial-found">' . esc_html__( 'No testimonials found', 'testimonial-free' ) . '</h2>';
344
  }
345
- if ( $total_rated_testimonials !== 0 ) {
346
  $aggregate_rating = round( ( $total_rating_count / $total_rated_testimonials ), 2 );
347
  }
348
  $outline .= '</div>';
349
- if ( $show_schema_markup && $total_rated_testimonials !== 0 ) {
350
  include SP_TFREE_PATH . '/public/views/schema.php';
351
  }
352
  $outline .= '</div>';
4
  *
5
  * @package testimonial-free
6
  */
7
+
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit; // Exit if accessed directly.
10
  }
11
 
 
 
 
 
 
12
  if ( ! class_exists( 'TFREE_Shortcode_Render' ) ) {
13
+ /**
14
+ * Testimonial - Shortcode Render class
15
+ *
16
+ * @since 2.0
17
+ */
18
  class TFREE_Shortcode_Render {
19
 
20
+ /**
21
+ * Five star review
22
+ *
23
+ * @var string
24
+ */
25
+ public $tfree_five_star = '<i class="fa fa-star" aria-hidden="true"></i>
26
  <i class="fa fa-star" aria-hidden="true"></i>
27
  <i class="fa fa-star" aria-hidden="true"></i>
28
  <i class="fa fa-star" aria-hidden="true"></i>
29
  <i class="fa fa-star" aria-hidden="true"></i>
30
  ';
31
+ /**
32
+ * Four star review
33
+ *
34
+ * @var string
35
+ */
36
+ public $tfree_four_star = '
37
  <i class="fa fa-star" aria-hidden="true"></i>
38
  <i class="fa fa-star" aria-hidden="true"></i>
39
  <i class="fa fa-star" aria-hidden="true"></i>
40
  <i class="fa fa-star" aria-hidden="true"></i>
41
  <i class="fa fa-star-o" aria-hidden="true"></i>
42
  ';
43
+ /**
44
+ * Three star review
45
+ *
46
+ * @var string
47
+ */
48
  public $tfree_three_star = '
49
  <i class="fa fa-star" aria-hidden="true"></i>
50
  <i class="fa fa-star" aria-hidden="true"></i>
52
  <i class="fa fa-star-o" aria-hidden="true"></i>
53
  <i class="fa fa-star-o" aria-hidden="true"></i>
54
  ';
55
+ /**
56
+ * Tow star review
57
+ *
58
+ * @var string
59
+ */
60
+ public $tfree_two_star = '
61
  <i class="fa fa-star" aria-hidden="true"></i>
62
  <i class="fa fa-star" aria-hidden="true"></i>
63
  <i class="fa fa-star-o" aria-hidden="true"></i>
64
  <i class="fa fa-star-o" aria-hidden="true"></i>
65
  <i class="fa fa-star-o" aria-hidden="true"></i>
66
  ';
67
+ /**
68
+ * One star review
69
+ *
70
+ * @var string
71
+ */
72
+ public $tfree_one_star = '
73
  <i class="fa fa-star" aria-hidden="true"></i>
74
  <i class="fa fa-star-o" aria-hidden="true"></i>
75
  <i class="fa fa-star-o" aria-hidden="true"></i>
78
  ';
79
 
80
  /**
81
+ * Single instance of the class.
82
  *
83
+ * @var null
84
  * @since 2.0
85
  */
86
  protected static $_instance = null;
109
  }
110
 
111
  /**
112
+ * Shorcode render.
113
+ *
114
+ * @param array $attributes Schortcode attributes.
115
  *
116
  * @return string
117
  * @since 2.0
212
  $swipe_to_slide = isset( $shortcode_data['swipe_to_slide'] ) && $shortcode_data['swipe_to_slide'] ? 'true' : 'false';
213
  $slider_draggable = isset( $shortcode_data['slider_draggable'] ) && $shortcode_data['slider_draggable'] ? 'true' : 'false';
214
  $slider_direction = isset( $shortcode_data['slider_direction'] ) ? $shortcode_data['slider_direction'] : 'ltr';
215
+ $rtl_mode = ( 'rtl' === $slider_direction ) ? 'true' : 'false';
216
 
217
  // Display Settings.
218
  $section_title = isset( $shortcode_data['section_title'] ) ? $shortcode_data['section_title'] : '';
274
  color: ' . $navigation_hover_color . ';
275
  }
276
  ';
277
+ if ( 'true' === $navigation ) {
278
  $outline .= '#sp-testimonial-free-wrapper-' . $post_id . ' .sp-testimonial-free-section{
279
  padding: 0 50px;
280
  }';
371
  } else {
372
  $outline .= '<h2 class="sp-not-testimonial-found">' . esc_html__( 'No testimonials found', 'testimonial-free' ) . '</h2>';
373
  }
374
+ if ( 0 !== $total_rated_testimonials ) {
375
  $aggregate_rating = round( ( $total_rating_count / $total_rated_testimonials ), 2 );
376
  }
377
  $outline .= '</div>';
378
+ if ( $show_schema_markup && 0 !== $total_rated_testimonials ) {
379
  include SP_TFREE_PATH . '/public/views/schema.php';
380
  }
381
  $outline .= '</div>';
public/views/templates/theme-one.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  /**
3
  * Theme One
 
 
4
  */
5
 
6
  $outline .= '<div class="sp-testimonial-free-item">';
1
  <?php
2
  /**
3
  * Theme One
4
+ *
5
+ * @package Testimonial
6
  */
7
 
8
  $outline .= '<div class="sp-testimonial-free-item">';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shapedplugin.com/donate
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews
5
  Requires at least: 4.0
6
  Tested up to: 5.8
7
- Stable tag: 2.2.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,10 @@ Thank you!
194
 
195
  == Changelog ==
196
 
 
 
 
 
197
  = 2.2.18 - Aug 18, 2021 =
198
  * Fix: Schema markup undefine issue.
199
 
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews
5
  Requires at least: 4.0
6
  Tested up to: 5.8
7
+ Stable tag: 2.2.19
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
194
 
195
  == Changelog ==
196
 
197
+ = 2.2.19 - Sep 16, 2021 =
198
+ * Improved: Plugin security.
199
+ * Removed: Unused code.
200
+
201
  = 2.2.18 - Aug 18, 2021 =
202
  * Fix: Schema markup undefine issue.
203
 
testimonial-free.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Testimonial
13
  * Plugin URI: https://shapedplugin.com/plugin/testimonial-pro/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
- * Version: 2.2.18
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
@@ -59,30 +59,40 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
59
  *
60
  * @var string
61
  */
62
- public $version = '2.2.18';
63
 
64
  /**
65
- * @var SP_TFREE_Testimonial $shortcode
 
 
66
  */
67
  public $testimonial;
68
 
69
  /**
 
 
70
  * @var SP_TFREE_Shortcodes $shortcode
71
  */
72
  public $shortcode;
73
 
74
  /**
 
 
75
  * @var SP_TFREE_Router $router
76
  */
77
  public $router;
78
 
79
  /**
 
 
80
  * @var null
81
  * @since 2.0
82
  */
83
  protected static $_instance = null;
84
 
85
  /**
 
 
86
  * @return SP_Testimonial_FREE
87
  * @since 2.0
88
  */
@@ -97,7 +107,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
97
  /**
98
  * SP_Testimonial_FREE constructor.
99
  */
100
- function __construct() {
101
  // Define constants.
102
  $this->define_constants();
103
 
@@ -122,7 +132,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
122
  *
123
  * @return void
124
  */
125
- function init_filters() {
126
  add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 2 );
127
  add_filter( 'manage_spt_shortcodes_posts_columns', array( $this, 'add_shortcode_column' ) );
128
  add_filter( 'plugin_row_meta', array( $this, 'after_testimonial_free_row_meta' ), 10, 4 );
@@ -134,7 +144,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
134
  *
135
  * @return void
136
  */
137
- function init_actions() {
138
  add_action( 'plugins_loaded', array( $this, 'load_text_domain' ) );
139
  add_action( 'manage_spt_shortcodes_posts_custom_column', array( $this, 'add_shortcode_form' ), 10, 2 );
140
  add_action( 'manage_spt_testimonial_posts_custom_column', array( $this, 'add_testimonial_extra_column' ), 10, 2 );
@@ -161,12 +171,12 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
161
  }
162
 
163
  /**
164
- * Define constant if not already set
165
  *
166
  * @since 2.0
167
  *
168
- * @param string $name
169
- * @param string|bool $value
170
  */
171
  public function define( $name, $value ) {
172
  if ( ! defined( $name ) ) {
@@ -187,9 +197,11 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
187
  /**
188
  * Add plugin action menu
189
  *
190
- * @param array $links
191
- * @param string $file
192
  *
 
 
 
193
  * @return array
194
  */
195
  public function add_plugin_action_links( $links, $file ) {
@@ -213,12 +225,12 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
213
  *
214
  * @since 2.0
215
  *
216
- * @param $plugin_meta
217
- * @param $file
218
  *
219
- * @return array
220
  */
221
- function after_testimonial_free_row_meta( $plugin_meta, $file ) {
222
  if ( SP_TFREE_BASENAME === $file ) {
223
  $plugin_meta[] = '<a href="https://demo.shapedplugin.com/testimonial/" target="_blank">' . __( 'Live Demo', 'testimonial-free' ) . '</a>';
224
  }
@@ -229,9 +241,9 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
229
  /**
230
  * Autoload class files on demand
231
  *
232
- * @param string $class requested class name
233
  */
234
- function autoload( $class ) {
235
  $name = explode( '_', $class );
236
  if ( isset( $name[2] ) ) {
237
  $class_name = strtolower( $name[2] );
@@ -248,7 +260,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
248
  *
249
  * @since 2.0
250
  */
251
- function instantiate() {
252
  $this->testimonial = SP_TFREE_Testimonial::getInstance();
253
  $this->shortcode = SP_TFREE_Shortcodes::getInstance();
254
 
@@ -256,11 +268,11 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
256
  }
257
 
258
  /**
259
- * page router instantiate.
260
  *
261
  * @since 2.0
262
  */
263
- function page() {
264
  $this->router = SP_TFREE_Router::instance();
265
 
266
  return $this->router;
@@ -271,19 +283,17 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
271
  *
272
  * @return void
273
  */
274
- function includes() {
275
  $this->page()->sp_tfree_function();
276
  $this->router->includes();
277
  }
278
 
279
  /**
280
- * ShortCode Column
281
- *
282
- * @param $columns
283
  *
284
  * @return array
285
  */
286
- function add_shortcode_column() {
287
  $new_columns['cb'] = '<input type="checkbox" />';
288
  $new_columns['title'] = __( 'Slider Title', 'testimonial-free' );
289
  $new_columns['shortcode'] = __( 'Shortcode', 'testimonial-free' );
@@ -294,17 +304,20 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
294
  }
295
 
296
  /**
297
- * @param $column
298
- * @param $post_id
 
 
 
 
299
  */
300
- function add_shortcode_form( $column, $post_id ) {
301
 
302
  switch ( $column ) {
303
 
304
  case 'shortcode':
305
- $column_field = '<input class="sp_tfree_input" style="width: 230px;padding: 4px 8px;" type="text" readonly="readonly" value="[sp_testimonial ' . 'id=&quot;' . $post_id . '&quot;' . ']"/>
306
  <div class="sptpro-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>';
307
- echo $column_field;
308
  break;
309
  default:
310
  break;
@@ -316,11 +329,9 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
316
  /**
317
  * Testimonial Column
318
  *
319
- * @param $columns
320
- *
321
  * @return array
322
  */
323
- function add_testimonial_column() {
324
  $new_columns['cb'] = '<input type="checkbox" />';
325
  $new_columns['title'] = __( 'Title', 'testimonial-free' );
326
  $new_columns['image'] = __( 'Image', 'testimonial-free' );
@@ -333,10 +344,12 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
333
  }
334
 
335
  /**
336
- * @param $column
337
- * @param $post_id
 
 
338
  */
339
- function add_testimonial_extra_column( $column, $post_id ) {
340
 
341
  switch ( $column ) {
342
 
@@ -367,7 +380,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
367
  break;
368
  }
369
 
370
- echo $column_field;
371
  }
372
 
373
  break;
@@ -376,8 +389,8 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
376
 
377
  $thumb_id = get_post_thumbnail_id( $post_id );
378
  $testimonial_client_image = wp_get_attachment_image_src( $thumb_id, 'sp_tfree_client_small_img' );
379
- if ( $testimonial_client_image !== '' && is_array( $testimonial_client_image ) ) {
380
- echo '<img src="' . $testimonial_client_image[0] . '" width="' . $testimonial_client_image[1] . '" height="' . $testimonial_client_image[2] . '"/>';
381
  } else {
382
  echo '<span aria-hidden="true">—</span>';
383
  }
@@ -388,7 +401,7 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
388
  $testimonial_data = get_post_meta( $post_id, 'sp_tpro_meta_options', true );
389
  if ( isset( $testimonial_data['tpro_name'] ) ) {
390
  $testimonial_client_name = $testimonial_data['tpro_name'];
391
- if ( $testimonial_client_name !== '' ) {
392
  echo esc_html( $testimonial_client_name );
393
  } else {
394
  echo '<span aria-hidden="true">—</span>';
@@ -401,13 +414,14 @@ if ( ! class_exists( 'SP_Testimonial_FREE' ) ) {
401
  }
402
 
403
  /**
404
- * Redirect after active
405
  *
406
- * @param $plugin
407
  */
408
- function redirect_help_page( $plugin ) {
409
  if ( SP_TFREE_BASENAME === $plugin ) {
410
- exit( wp_redirect( admin_url( 'edit.php?post_type=spt_testimonial&page=tfree_help' ) ) );
 
411
  }
412
  }
413
 
12
  * Plugin Name: Testimonial
13
  * Plugin URI: https://shapedplugin.com/plugin/testimonial-pro/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
+ * Version: 2.2.19
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
59
  *
60
  * @var string
61
  */
62
+ public $version = '2.2.19';
63
 
64
  /**
65
+ * Plugin testimonial.
66
+ *
67
+ * @var SP_TFREE_Testimonial $testimonial
68
  */
69
  public $testimonial;
70
 
71
  /**
72
+ * Plugin short code.
73
+ *
74
  * @var SP_TFREE_Shortcodes $shortcode
75
  */
76
  public $shortcode;
77
 
78
  /**
79
+ * Plugin router.
80
+ *
81
  * @var SP_TFREE_Router $router
82
  */
83
  public $router;
84
 
85
  /**
86
+ * Holds class object.
87
+ *
88
  * @var null
89
  * @since 2.0
90
  */
91
  protected static $_instance = null;
92
 
93
  /**
94
+ * Initialize the SP_Testimonial_FREE() class.
95
+ *
96
  * @return SP_Testimonial_FREE
97
  * @since 2.0
98
  */
107
  /**
108
  * SP_Testimonial_FREE constructor.
109
  */
110
+ public function __construct() {
111
  // Define constants.
112
  $this->define_constants();
113
 
132
  *
133
  * @return void
134
  */
135
+ public function init_filters() {
136
  add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 2 );
137
  add_filter( 'manage_spt_shortcodes_posts_columns', array( $this, 'add_shortcode_column' ) );
138
  add_filter( 'plugin_row_meta', array( $this, 'after_testimonial_free_row_meta' ), 10, 4 );
144
  *
145
  * @return void
146
  */
147
+ public function init_actions() {
148
  add_action( 'plugins_loaded', array( $this, 'load_text_domain' ) );
149
  add_action( 'manage_spt_shortcodes_posts_custom_column', array( $this, 'add_shortcode_form' ), 10, 2 );
150
  add_action( 'manage_spt_testimonial_posts_custom_column', array( $this, 'add_testimonial_extra_column' ), 10, 2 );
171
  }
172
 
173
  /**
174
+ * Define constant if not already set.
175
  *
176
  * @since 2.0
177
  *
178
+ * @param string $name Constant name.
179
+ * @param string|bool $value Constant value.
180
  */
181
  public function define( $name, $value ) {
182
  if ( ! defined( $name ) ) {
197
  /**
198
  * Add plugin action menu
199
  *
200
+ * Fired by `plugin_action_links` filter.
 
201
  *
202
+ * @param array $links The action link.
203
+ * @param string $file The file.
204
+ * @since 2.0.0
205
  * @return array
206
  */
207
  public function add_plugin_action_links( $links, $file ) {
225
  *
226
  * @since 2.0
227
  *
228
+ * @param array $plugin_meta An array of the plugin's metadata.
229
+ * @param string $file Path to the plugin file.
230
  *
231
+ * @return array An array of plugin row meta links
232
  */
233
+ public function after_testimonial_free_row_meta( $plugin_meta, $file ) {
234
  if ( SP_TFREE_BASENAME === $file ) {
235
  $plugin_meta[] = '<a href="https://demo.shapedplugin.com/testimonial/" target="_blank">' . __( 'Live Demo', 'testimonial-free' ) . '</a>';
236
  }
241
  /**
242
  * Autoload class files on demand
243
  *
244
+ * @param string $class requested class name.
245
  */
246
+ public function autoload( $class ) {
247
  $name = explode( '_', $class );
248
  if ( isset( $name[2] ) ) {
249
  $class_name = strtolower( $name[2] );
260
  *
261
  * @since 2.0
262
  */
263
+ public function instantiate() {
264
  $this->testimonial = SP_TFREE_Testimonial::getInstance();
265
  $this->shortcode = SP_TFREE_Shortcodes::getInstance();
266
 
268
  }
269
 
270
  /**
271
+ * Page router instantiate.
272
  *
273
  * @since 2.0
274
  */
275
+ public function page() {
276
  $this->router = SP_TFREE_Router::instance();
277
 
278
  return $this->router;
283
  *
284
  * @return void
285
  */
286
+ public function includes() {
287
  $this->page()->sp_tfree_function();
288
  $this->router->includes();
289
  }
290
 
291
  /**
292
+ * ShortCode Column.
 
 
293
  *
294
  * @return array
295
  */
296
+ public function add_shortcode_column() {
297
  $new_columns['cb'] = '<input type="checkbox" />';
298
  $new_columns['title'] = __( 'Slider Title', 'testimonial-free' );
299
  $new_columns['shortcode'] = __( 'Shortcode', 'testimonial-free' );
304
  }
305
 
306
  /**
307
+ * Display admin columns for the testimonial.
308
+ *
309
+ * @param string $column The columns.
310
+ * @param int $post_id The post ID.
311
+ * @since 2.0.0
312
+ * @return void
313
  */
314
+ public function add_shortcode_form( $column, $post_id ) {
315
 
316
  switch ( $column ) {
317
 
318
  case 'shortcode':
319
+ echo '<input class="sp_tfree_input" style="width: 230px;padding: 4px 8px;" type="text" readonly="readonly" value="[sp_testimonial id=&quot;' . esc_attr( $post_id ) . '&quot;]"/>
320
  <div class="sptpro-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>';
 
321
  break;
322
  default:
323
  break;
329
  /**
330
  * Testimonial Column
331
  *
 
 
332
  * @return array
333
  */
334
+ public function add_testimonial_column() {
335
  $new_columns['cb'] = '<input type="checkbox" />';
336
  $new_columns['title'] = __( 'Title', 'testimonial-free' );
337
  $new_columns['image'] = __( 'Image', 'testimonial-free' );
344
  }
345
 
346
  /**
347
+ * Display testimonial member columns.
348
+ *
349
+ * @param string $column The columns.
350
+ * @param int $post_id The post ID.
351
  */
352
+ public function add_testimonial_extra_column( $column, $post_id ) {
353
 
354
  switch ( $column ) {
355
 
380
  break;
381
  }
382
 
383
+ echo wp_kses_post( $column_field );
384
  }
385
 
386
  break;
389
 
390
  $thumb_id = get_post_thumbnail_id( $post_id );
391
  $testimonial_client_image = wp_get_attachment_image_src( $thumb_id, 'sp_tfree_client_small_img' );
392
+ if ( '' !== $testimonial_client_image && is_array( $testimonial_client_image ) ) {
393
+ echo '<img src="' . esc_url( $testimonial_client_image[0] ) . '" width="' . esc_attr( $testimonial_client_image[1] ) . '" height="' . esc_attr( $testimonial_client_image[2] ) . '"/>';
394
  } else {
395
  echo '<span aria-hidden="true">—</span>';
396
  }
401
  $testimonial_data = get_post_meta( $post_id, 'sp_tpro_meta_options', true );
402
  if ( isset( $testimonial_data['tpro_name'] ) ) {
403
  $testimonial_client_name = $testimonial_data['tpro_name'];
404
+ if ( '' !== $testimonial_client_name ) {
405
  echo esc_html( $testimonial_client_name );
406
  } else {
407
  echo '<span aria-hidden="true">—</span>';
414
  }
415
 
416
  /**
417
+ * Redirect after active.
418
  *
419
+ * @param string $plugin Plugin base name.
420
  */
421
+ public function redirect_help_page( $plugin ) {
422
  if ( SP_TFREE_BASENAME === $plugin ) {
423
+ wp_safe_redirect( admin_url( 'edit.php?post_type=spt_testimonial&page=tfree_help' ) );
424
+ exit();
425
  }
426
  }
427