Accordion - Version 2.2.45

Version Description

  • 2022-08-24 - fix - remove unnecessary file codemirror.js file.
    • 2022-08-24 - fix - custom script escape issue fixed.
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Accordion
Version 2.2.45
Comparing to
See all releases

Code changes from version 2.2.44 to 2.2.45

Files changed (36) hide show
  1. accordions.php +2 -2
  2. includes/3rd-party/accordion-shortcodes/functions-data-import.php +0 -2
  3. includes/3rd-party/arconix-faq/functions-data-import.php +1 -5
  4. includes/3rd-party/easy-accordion-free/functions-data-import.php +0 -6
  5. includes/3rd-party/easy-responsive-tabs/functions-data-import.php +1 -7
  6. includes/3rd-party/everest-tab-lite/functions-data-import.php +1 -6
  7. includes/3rd-party/helpie-faq/functions-data-import.php +0 -5
  8. includes/3rd-party/meks-flexible-shortcodes/functions-data-import.php +0 -2
  9. includes/3rd-party/quick-and-easy-faqs/functions-data-import.php +0 -5
  10. includes/3rd-party/responsive-accordion-and-collapse/functions-data-import.php +1 -6
  11. includes/3rd-party/responsive-tabs/functions-data-import.php +0 -6
  12. includes/3rd-party/shortcodes-ultimate/functions-data-import.php +0 -2
  13. includes/3rd-party/sp-faq/functions-data-import.php +1 -5
  14. includes/3rd-party/squelch-tabs-and-accordions-shortcodes/functions-data-import.php +0 -2
  15. includes/3rd-party/tabby-responsive-tabs/functions-data-import.php +0 -4
  16. includes/3rd-party/tabs-pro/functions-data-import.php +1 -7
  17. includes/3rd-party/tabs-responsive/functions-data-import.php +1 -6
  18. includes/3rd-party/tabs-shortcode/functions-data-import.php +0 -2
  19. includes/3rd-party/ultimate-faqs/functions-data-import.php +0 -5
  20. includes/3rd-party/vc-tabs/functions-data-import.php +1 -6
  21. includes/3rd-party/wc-shortcodes/functions-data-import.php +0 -2
  22. includes/3rd-party/wonderplugin-tabs-trial/functions-data-import.php +0 -7
  23. includes/3rd-party/wp-shortcode/functions-data-import.php +0 -2
  24. includes/class-post-meta-accordions-hook.php +4 -6
  25. includes/class-post-meta-accordions.php +1 -1
  26. includes/class-settings-hook.php +7 -19
  27. includes/class-settings-tabs.php +1211 -1221
  28. includes/class-widget-accordions.php +21 -13
  29. includes/functions-data-upgrade.php +0 -1
  30. includes/functions-wc.php +29 -30
  31. includes/functions.php +1 -5
  32. includes/menu/settings.php +3 -3
  33. includes/menu/upgrade-status.php +0 -1
  34. readme.txt +6 -1
  35. templates/accordion/accordion-hook.php +78 -77
  36. templates/tabs/tabs-hook.php +29 -29
accordions.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accordions by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
5
  Description: Fully responsive and mobile ready accordion grid for wordpress.
6
- Version: 2.2.44
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
@@ -23,7 +23,7 @@ class Accordions
23
 
24
  define('accordions_plugin_url', plugins_url('/', __FILE__));
25
  define('accordions_plugin_dir', plugin_dir_path(__FILE__));
26
- define('accordions_version', '2.2.44');
27
  define('accordions_plugin_name', 'Accordions');
28
  define('accordions_plugin_basename', plugin_basename(__FILE__));
29
 
3
  Plugin Name: Accordions by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
5
  Description: Fully responsive and mobile ready accordion grid for wordpress.
6
+ Version: 2.2.45
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
23
 
24
  define('accordions_plugin_url', plugins_url('/', __FILE__));
25
  define('accordions_plugin_dir', plugin_dir_path(__FILE__));
26
+ define('accordions_version', '2.2.45');
27
  define('accordions_plugin_name', 'Accordions');
28
  define('accordions_plugin_basename', plugin_basename(__FILE__));
29
 
includes/3rd-party/accordion-shortcodes/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_accordion_shortcodes(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_accordion_shortcodes(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[accordion') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[accordion", "[/accordion]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[accordion') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[accordion", "[/accordion]");
includes/3rd-party/arconix-faq/functions-data-import.php CHANGED
@@ -138,7 +138,6 @@ function accordions_import_cron_arconix_faq(){
138
  $index++;
139
  endwhile;
140
 
141
- echo '<pre>'.var_export($accordions_options, true).'</pre>';
142
 
143
 
144
  $post_data = array(
@@ -155,10 +154,7 @@ function accordions_import_cron_arconix_faq(){
155
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
156
 
157
 
158
- echo '##################';
159
- echo '<br/>';
160
- echo 'import done: '.$post_title;
161
- echo '<br/>';
162
 
163
 
164
  wp_reset_query();
138
  $index++;
139
  endwhile;
140
 
 
141
 
142
 
143
  $post_data = array(
154
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
155
 
156
 
157
+
 
 
 
158
 
159
 
160
  wp_reset_query();
includes/3rd-party/easy-accordion-free/functions-data-import.php CHANGED
@@ -39,7 +39,6 @@ function accordions_import_cron_easy_accordion_free(){
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
42
- //echo $accordions_title.'<br/>';
43
  $sp_eap_upload_options = get_post_meta( $post_id, 'sp_eap_upload_options', true );
44
  $sp_eap_shortcode_options = get_post_meta( $post_id, 'sp_eap_shortcode_options', true );
45
 
@@ -47,7 +46,6 @@ function accordions_import_cron_easy_accordion_free(){
47
  $accordion_content_source = $sp_eap_upload_options['accordion_content_source'];
48
 
49
 
50
- echo '<pre>'.var_export($accordion_content_source, true).'</pre>';
51
 
52
 
53
  $eap_accordion_event = $sp_eap_shortcode_options['eap_accordion_event'];
@@ -199,10 +197,6 @@ function accordions_import_cron_easy_accordion_free(){
199
  update_post_meta($post_id, 'import_done', 'done');
200
 
201
 
202
- echo '##################';
203
- echo '<br/>';
204
- echo 'import done: '.$post_title;
205
- echo '<br/>';
206
 
207
  wp_reset_query();
208
  wp_reset_postdata();
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
 
42
  $sp_eap_upload_options = get_post_meta( $post_id, 'sp_eap_upload_options', true );
43
  $sp_eap_shortcode_options = get_post_meta( $post_id, 'sp_eap_shortcode_options', true );
44
 
46
  $accordion_content_source = $sp_eap_upload_options['accordion_content_source'];
47
 
48
 
 
49
 
50
 
51
  $eap_accordion_event = $sp_eap_shortcode_options['eap_accordion_event'];
197
  update_post_meta($post_id, 'import_done', 'done');
198
 
199
 
 
 
 
 
200
 
201
  wp_reset_query();
202
  wp_reset_postdata();
includes/3rd-party/easy-responsive-tabs/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_easy_responsive_tabs(){
41
 
42
  $accordions_options = array();
43
 
44
- //echo '<pre>'.var_export($acc_sec_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -116,8 +115,6 @@ function accordions_import_cron_easy_responsive_tabs(){
116
  foreach ($tabs as $tab_content){
117
 
118
  $shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag='restab');
119
- echo '<pre>'.var_export('#####', true).'</pre>';
120
- echo '<pre>'.var_export($shortcode_content, true).'</pre>';
121
 
122
 
123
 
@@ -180,10 +177,7 @@ function accordions_import_cron_easy_responsive_tabs(){
180
  update_post_meta($post_id, 'import_done', 'done');
181
 
182
 
183
- echo '##################';
184
- echo '<br/>';
185
- echo 'import done: '.$post_title;
186
- echo '<br/>';
187
 
188
 
189
 
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
115
  foreach ($tabs as $tab_content){
116
 
117
  $shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag='restab');
 
 
118
 
119
 
120
 
177
  update_post_meta($post_id, 'import_done', 'done');
178
 
179
 
180
+
 
 
 
181
 
182
 
183
 
includes/3rd-party/everest-tab-lite/functions-data-import.php CHANGED
@@ -39,12 +39,10 @@ function accordions_import_cron_everest_tab_lite(){
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
42
- //echo $accordions_title.'<br/>';
43
  $et_main_settings = get_post_meta( $post_id, 'et_main_settings', true );
44
  $et_tab_settings = get_post_meta( $post_id, 'et_tab_settings', true );
45
 
46
 
47
- echo '<pre>'.var_export($et_tab_settings, true).'</pre>';
48
 
49
  $tab_items = $et_main_settings['tab_items'];
50
 
@@ -196,10 +194,7 @@ function accordions_import_cron_everest_tab_lite(){
196
  update_post_meta($post_id, 'import_done', 'done');
197
 
198
 
199
- echo '##################';
200
- echo '<br/>';
201
- echo 'import done: '.$post_title;
202
- echo '<br/>';
203
 
204
  wp_reset_query();
205
  wp_reset_postdata();
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
 
42
  $et_main_settings = get_post_meta( $post_id, 'et_main_settings', true );
43
  $et_tab_settings = get_post_meta( $post_id, 'et_tab_settings', true );
44
 
45
 
 
46
 
47
  $tab_items = $et_main_settings['tab_items'];
48
 
194
  update_post_meta($post_id, 'import_done', 'done');
195
 
196
 
197
+
 
 
 
198
 
199
  wp_reset_query();
200
  wp_reset_postdata();
includes/3rd-party/helpie-faq/functions-data-import.php CHANGED
@@ -138,7 +138,6 @@ function accordions_import_cron_helpie_faq(){
138
  $index++;
139
  endwhile;
140
 
141
- echo '<pre>'.var_export($accordions_options, true).'</pre>';
142
 
143
 
144
  $post_data = array(
@@ -155,10 +154,6 @@ function accordions_import_cron_helpie_faq(){
155
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
156
 
157
 
158
- echo '##################';
159
- echo '<br/>';
160
- echo 'import done: '.$post_title;
161
- echo '<br/>';
162
 
163
 
164
  wp_reset_query();
138
  $index++;
139
  endwhile;
140
 
 
141
 
142
 
143
  $post_data = array(
154
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
155
 
156
 
 
 
 
 
157
 
158
 
159
  wp_reset_query();
includes/3rd-party/meks-flexible-shortcodes/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_meks_flexible_shortcodes(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_meks_flexible_shortcodes(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[mks_accordion') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[mks_accordion", "[/mks_accordion]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[mks_accordion') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[mks_accordion", "[/mks_accordion]");
includes/3rd-party/quick-and-easy-faqs/functions-data-import.php CHANGED
@@ -132,7 +132,6 @@ function accordions_import_cron_quick_easy_faqs(){
132
  $index++;
133
  endwhile;
134
 
135
- echo '<pre>'.var_export($accordions_options, true).'</pre>';
136
 
137
 
138
  $post_data = array(
@@ -149,10 +148,6 @@ function accordions_import_cron_quick_easy_faqs(){
149
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
150
 
151
 
152
- echo '##################';
153
- echo '<br/>';
154
- echo 'import done: '.$post_title;
155
- echo '<br/>';
156
 
157
 
158
  wp_reset_query();
132
  $index++;
133
  endwhile;
134
 
 
135
 
136
 
137
  $post_data = array(
148
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
149
 
150
 
 
 
 
 
151
 
152
 
153
  wp_reset_query();
includes/3rd-party/responsive-accordion-and-collapse/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_responsive_accordion_collapse(){
41
  $post_title = get_the_title();
42
  $accordions_options = array();
43
 
44
- //echo $accordions_title.'<br/>';
45
  $wpsm_accordion_data = get_post_meta( $post_id, 'wpsm_accordion_data', true );
46
  $wpsm_accordion_data = unserialize( $wpsm_accordion_data );
47
 
@@ -69,7 +68,6 @@ function accordions_import_cron_responsive_accordion_collapse(){
69
 
70
 
71
 
72
- //echo '<pre>'.var_export($acc_sec_title, true).'</pre>';
73
 
74
  $accordions_icons_plus = 'plus';
75
  $accordions_icons_minus = 'minus';
@@ -210,10 +208,7 @@ function accordions_import_cron_responsive_accordion_collapse(){
210
  update_post_meta($post_id, 'import_done', 'done');
211
 
212
 
213
- echo '##################';
214
- echo '<br/>';
215
- echo 'import done: '.$post_title;
216
- echo '<br/>';
217
 
218
  wp_reset_query();
219
  wp_reset_postdata();
41
  $post_title = get_the_title();
42
  $accordions_options = array();
43
 
 
44
  $wpsm_accordion_data = get_post_meta( $post_id, 'wpsm_accordion_data', true );
45
  $wpsm_accordion_data = unserialize( $wpsm_accordion_data );
46
 
68
 
69
 
70
 
 
71
 
72
  $accordions_icons_plus = 'plus';
73
  $accordions_icons_minus = 'minus';
208
  update_post_meta($post_id, 'import_done', 'done');
209
 
210
 
211
+
 
 
 
212
 
213
  wp_reset_query();
214
  wp_reset_postdata();
includes/3rd-party/responsive-tabs/functions-data-import.php CHANGED
@@ -40,12 +40,10 @@ function accordions_import_cron_responsive_tabs(){
40
  $post_title = get_the_title();
41
  $accordions_options = array();
42
 
43
- //echo $accordions_title.'<br/>';
44
  $_rtbs_tabs_head = get_post_meta( $post_id, '_rtbs_tabs_head', true );
45
 
46
 
47
 
48
- echo '<pre>'.var_export($_rtbs_tabs_head, true).'</pre>';
49
 
50
 
51
 
@@ -178,10 +176,6 @@ function accordions_import_cron_responsive_tabs(){
178
  update_post_meta($post_id, 'import_done', 'done');
179
 
180
 
181
- echo '##################';
182
- echo '<br/>';
183
- echo 'import done: '.$post_title;
184
- echo '<br/>';
185
 
186
  wp_reset_query();
187
  wp_reset_postdata();
40
  $post_title = get_the_title();
41
  $accordions_options = array();
42
 
 
43
  $_rtbs_tabs_head = get_post_meta( $post_id, '_rtbs_tabs_head', true );
44
 
45
 
46
 
 
47
 
48
 
49
 
176
  update_post_meta($post_id, 'import_done', 'done');
177
 
178
 
 
 
 
 
179
 
180
  wp_reset_query();
181
  wp_reset_postdata();
includes/3rd-party/shortcodes-ultimate/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_shortcodes_ultimate(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_shortcodes_ultimate(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[su_accordion') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[su_accordion", "[/su_accordion]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[su_accordion') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[su_accordion", "[/su_accordion]");
includes/3rd-party/sp-faq/functions-data-import.php CHANGED
@@ -138,7 +138,6 @@ function accordions_import_cron_sp_faq(){
138
  $index++;
139
  endwhile;
140
 
141
- //echo '<pre>'.var_export($accordions_options, true).'</pre>';
142
 
143
 
144
  $post_data = array(
@@ -155,10 +154,7 @@ function accordions_import_cron_sp_faq(){
155
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
156
 
157
 
158
- echo '##################';
159
- echo '<br/>';
160
- echo 'import done: '.$post_title;
161
- echo '<br/>';
162
 
163
 
164
  wp_reset_query();
138
  $index++;
139
  endwhile;
140
 
 
141
 
142
 
143
  $post_data = array(
154
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
155
 
156
 
157
+
 
 
 
158
 
159
 
160
  wp_reset_query();
includes/3rd-party/squelch-tabs-and-accordions-shortcodes/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_squelch_tabs_accordions(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_squelch_tabs_accordions(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[accordions') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[accordions", "[/accordions]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[accordions') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[accordions", "[/accordions]");
includes/3rd-party/tabby-responsive-tabs/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_tabby_responsive_tabs(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,12 +107,10 @@ function accordions_import_cron_tabby_responsive_tabs(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[tabbyending') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[tabby", "[tabbyending]");
115
 
116
- echo '<pre>'.var_export($tabs, true).'</pre>';
117
 
118
  if(!empty($tabs))
119
  foreach ($tabs as $tab_content){
@@ -130,7 +127,6 @@ function accordions_import_cron_tabby_responsive_tabs(){
130
  $tab_content = explode(']', $tab);
131
  $tab_content = str_replace('[tabby','', $tab_content);
132
 
133
- //echo '<pre>'.var_export($tab_content, true).'</pre>';
134
  $shortcode_content[$i]['title'] = str_replace('"','',$tab_content[0]);
135
  $shortcode_content[$i]['content'] = $tab_content[1];
136
  $i++;
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[tabbyending') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[tabby", "[tabbyending]");
113
 
 
114
 
115
  if(!empty($tabs))
116
  foreach ($tabs as $tab_content){
127
  $tab_content = explode(']', $tab);
128
  $tab_content = str_replace('[tabby','', $tab_content);
129
 
 
130
  $shortcode_content[$i]['title'] = str_replace('"','',$tab_content[0]);
131
  $shortcode_content[$i]['content'] = $tab_content[1];
132
  $i++;
includes/3rd-party/tabs-pro/functions-data-import.php CHANGED
@@ -39,10 +39,8 @@ function accordions_import_cron_tabs_pro(){
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
42
- //echo $accordions_title.'<br/>';
43
  $custom_accordion_wordpresspro_columns = get_post_meta( $post_id, 'custom_accordion_wordpresspro_columns' );
44
 
45
- echo '<pre>'.var_export($custom_accordion_wordpresspro_columns, true).'</pre>';
46
 
47
  $accordions_icons_plus = 'plus';
48
  $accordions_icons_minus = 'minus';
@@ -143,7 +141,6 @@ function accordions_import_cron_tabs_pro(){
143
  }
144
 
145
 
146
- echo '<pre>'.var_export($accordions_options, true).'</pre>';
147
 
148
 
149
  $post_data = array(
@@ -161,10 +158,7 @@ function accordions_import_cron_tabs_pro(){
161
  update_post_meta($post_id, 'import_done', 'done');
162
 
163
 
164
- echo '##################';
165
- echo '<br/>';
166
- echo 'import done: '.$post_title;
167
- echo '<br/>';
168
 
169
  wp_reset_query();
170
  wp_reset_postdata();
39
  $post_title = get_the_title();
40
  $accordions_options = array();
41
 
 
42
  $custom_accordion_wordpresspro_columns = get_post_meta( $post_id, 'custom_accordion_wordpresspro_columns' );
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
141
  }
142
 
143
 
 
144
 
145
 
146
  $post_data = array(
158
  update_post_meta($post_id, 'import_done', 'done');
159
 
160
 
161
+
 
 
 
162
 
163
  wp_reset_query();
164
  wp_reset_postdata();
includes/3rd-party/tabs-responsive/functions-data-import.php CHANGED
@@ -40,7 +40,6 @@ function accordions_import_cron_tabs_responsive(){
40
  $post_title = get_the_title();
41
  $accordions_options = array();
42
 
43
- //echo $accordions_title.'<br/>';
44
  $wpsm_tabs_r_data = get_post_meta( $post_id, 'wpsm_tabs_r_data', true );
45
  $wpsm_tabs_r_data = unserialize( $wpsm_tabs_r_data );
46
 
@@ -74,7 +73,6 @@ function accordions_import_cron_tabs_responsive(){
74
 
75
 
76
 
77
- echo '<pre>'.var_export($tabs_sec_title, true).'</pre>';
78
 
79
  $accordions_icons_plus = 'plus';
80
  $accordions_icons_minus = 'minus';
@@ -196,10 +194,7 @@ function accordions_import_cron_tabs_responsive(){
196
  update_post_meta($post_id, 'import_done', 'done');
197
 
198
 
199
- echo '##################';
200
- echo '<br/>';
201
- echo 'import done: '.$post_title;
202
- echo '<br/>';
203
 
204
  wp_reset_query();
205
  wp_reset_postdata();
40
  $post_title = get_the_title();
41
  $accordions_options = array();
42
 
 
43
  $wpsm_tabs_r_data = get_post_meta( $post_id, 'wpsm_tabs_r_data', true );
44
  $wpsm_tabs_r_data = unserialize( $wpsm_tabs_r_data );
45
 
73
 
74
 
75
 
 
76
 
77
  $accordions_icons_plus = 'plus';
78
  $accordions_icons_minus = 'minus';
194
  update_post_meta($post_id, 'import_done', 'done');
195
 
196
 
197
+
 
 
 
198
 
199
  wp_reset_query();
200
  wp_reset_postdata();
includes/3rd-party/tabs-shortcode/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_tabs_shortcode(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_tabs_shortcode(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[tabs') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[tabs", "[/tabs]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[tabs') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[tabs", "[/tabs]");
includes/3rd-party/ultimate-faqs/functions-data-import.php CHANGED
@@ -138,7 +138,6 @@ function accordions_import_cron_ultimate_faqs(){
138
  $index++;
139
  endwhile;
140
 
141
- //echo '<pre>'.var_export($accordions_options, true).'</pre>';
142
 
143
 
144
  $post_data = array(
@@ -155,10 +154,6 @@ function accordions_import_cron_ultimate_faqs(){
155
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
156
 
157
 
158
- // echo '##################';
159
- // echo '<br/>';
160
- // echo 'import done: '.$post_title;
161
- // echo '<br/>';
162
 
163
 
164
  wp_reset_query();
138
  $index++;
139
  endwhile;
140
 
 
141
 
142
 
143
  $post_data = array(
154
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
155
 
156
 
 
 
 
 
157
 
158
 
159
  wp_reset_query();
includes/3rd-party/vc-tabs/functions-data-import.php CHANGED
@@ -42,7 +42,6 @@ function accordions_import_cron_vc_tabs(){
42
  $post_title = get_the_title();
43
  $accordions_options = array();
44
 
45
- //echo $accordions_title.'<br/>';
46
  $wpsm_accordion_data = get_post_meta( $post_id, 'wpsm_accordion_data', true );
47
  $wpsm_accordion_data = unserialize( $wpsm_accordion_data );
48
 
@@ -70,7 +69,6 @@ function accordions_import_cron_vc_tabs(){
70
 
71
 
72
 
73
- echo '<pre>'.var_export($acc_sec_title, true).'</pre>';
74
 
75
  $accordions_icons_plus = 'plus';
76
  $accordions_icons_minus = 'minus';
@@ -210,10 +208,7 @@ function accordions_import_cron_vc_tabs(){
210
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
211
  update_post_meta($post_id, 'import_done', 'done');
212
 
213
- echo '##################';
214
- echo '<br/>';
215
- echo 'import done: '.$post_title;
216
- echo '<br/>';
217
 
218
  wp_reset_query();
219
  wp_reset_postdata();
42
  $post_title = get_the_title();
43
  $accordions_options = array();
44
 
 
45
  $wpsm_accordion_data = get_post_meta( $post_id, 'wpsm_accordion_data', true );
46
  $wpsm_accordion_data = unserialize( $wpsm_accordion_data );
47
 
69
 
70
 
71
 
 
72
 
73
  $accordions_icons_plus = 'plus';
74
  $accordions_icons_minus = 'minus';
208
  update_post_meta($accordions_id, 'accordions_options', $accordions_options);
209
  update_post_meta($post_id, 'import_done', 'done');
210
 
211
+
 
 
 
212
 
213
  wp_reset_query();
214
  wp_reset_postdata();
includes/3rd-party/wc-shortcodes/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_wc_shortcodes(){
41
 
42
  $accordions_options = array();
43
 
44
- //echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_wc_shortcodes(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
  if( strpos($post_content, '[wc_accordion') !== false){
114
  $tabs = accordions_str_between_all($post_content, "[wc_accordion", "[/wc_accordion]");
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
  if( strpos($post_content, '[wc_accordion') !== false){
112
  $tabs = accordions_str_between_all($post_content, "[wc_accordion", "[/wc_accordion]");
includes/3rd-party/wonderplugin-tabs-trial/functions-data-import.php CHANGED
@@ -20,8 +20,6 @@ function accordions_import_cron_wonderplugin_tabs_trial(){
20
  $item_row = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $table_name") );
21
  $results = $wpdb->get_results("SELECT * FROM $table_name", ARRAY_A);
22
 
23
- //echo '<pre>'.var_export($results, true).'</pre>';
24
- //echo '<pre>'.var_export('#########$results', true).'</pre>';
25
 
26
 
27
 
@@ -35,8 +33,6 @@ function accordions_import_cron_wonderplugin_tabs_trial(){
35
 
36
  $accordions_options = array();
37
 
38
- //echo '<pre>'.var_export($slides, true).'</pre>';
39
- //echo '<pre>'.var_export('#########$slides', true).'</pre>';
40
 
41
  $accordions_icons_plus = 'plus';
42
  $accordions_icons_minus = 'minus';
@@ -107,7 +103,6 @@ function accordions_import_cron_wonderplugin_tabs_trial(){
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
110
- //echo '<pre>'.var_export($slides, true).'</pre>';
111
 
112
 
113
  foreach ($slides as $index=> $slide){
@@ -117,7 +112,6 @@ function accordions_import_cron_wonderplugin_tabs_trial(){
117
  $tabtitle = $slide->tabtitle;
118
  $tabcontent = $slide->tabcontent;
119
 
120
- //echo '<pre>'.var_export($tabtitle, true).'</pre>';
121
 
122
 
123
 
@@ -132,7 +126,6 @@ function accordions_import_cron_wonderplugin_tabs_trial(){
132
  $accordions_options['content'][$index]['background_img'] = '';
133
  }
134
 
135
- echo '<pre>'.var_export($accordions_options, true).'</pre>';
136
 
137
  $post_data = array(
138
  'post_title' => $name,
20
  $item_row = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $table_name") );
21
  $results = $wpdb->get_results("SELECT * FROM $table_name", ARRAY_A);
22
 
 
 
23
 
24
 
25
 
33
 
34
  $accordions_options = array();
35
 
 
 
36
 
37
  $accordions_icons_plus = 'plus';
38
  $accordions_icons_minus = 'minus';
103
  $accordions_options['accordion']['is_child'] = '';
104
 
105
 
 
106
 
107
 
108
  foreach ($slides as $index=> $slide){
112
  $tabtitle = $slide->tabtitle;
113
  $tabcontent = $slide->tabcontent;
114
 
 
115
 
116
 
117
 
126
  $accordions_options['content'][$index]['background_img'] = '';
127
  }
128
 
 
129
 
130
  $post_data = array(
131
  'post_title' => $name,
includes/3rd-party/wp-shortcode/functions-data-import.php CHANGED
@@ -41,7 +41,6 @@ function accordions_import_cron_wp_shortcode(){
41
 
42
  $accordions_options = array();
43
 
44
- echo '<pre>'.var_export($post_title, true).'</pre>';
45
 
46
  $accordions_icons_plus = 'plus';
47
  $accordions_icons_minus = 'minus';
@@ -108,7 +107,6 @@ function accordions_import_cron_wp_shortcode(){
108
  $accordions_options['accordion']['is_child'] = '';
109
 
110
 
111
- //echo '<pre>'.var_export($post_content, true).'</pre>';
112
 
113
 
114
 
41
 
42
  $accordions_options = array();
43
 
 
44
 
45
  $accordions_icons_plus = 'plus';
46
  $accordions_icons_minus = 'minus';
107
  $accordions_options['accordion']['is_child'] = '';
108
 
109
 
 
110
 
111
 
112
 
includes/class-post-meta-accordions-hook.php CHANGED
@@ -40,12 +40,12 @@ function accordions_metabox_content_shortcode($post_id){
40
  </div>
41
 
42
  <div class="copy-to-clipboard">
43
- <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
44
  <p class="description"><?php echo __('PHP Code, you can use under theme .php files.','accordions'); ?></p>
45
  </div>
46
 
47
  <div class="copy-to-clipboard">
48
- <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_pplugins id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
49
  <p class="description"><?php echo __('To avoid conflict, PHP code you can use under theme .php files.','accordions'); ?></p>
50
  </div>
51
 
@@ -86,12 +86,12 @@ function accordions_metabox_content_shortcode($post_id){
86
  </div>
87
 
88
  <div class="copy-to-clipboard">
89
- <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_tabs id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
90
  <p class="description"><?php echo __('PHP Code, you can use under theme .php files.','accordions'); ?></p>
91
  </div>
92
 
93
  <div class="copy-to-clipboard">
94
- <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_tabs_pplugins id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
95
  <p class="description"><?php echo __('To avoid conflict, PHP code you can use under theme .php files.','accordions'); ?></p>
96
  </div>
97
 
@@ -1090,8 +1090,6 @@ function accordions_metabox_content_content($post_id){
1090
  <?php
1091
 
1092
 
1093
- //echo '<pre>'.var_export($accordions_active_accordion, true).'</pre>';
1094
- //echo '<pre>'.var_export($accordions_content_body, true).'</pre>';
1095
 
1096
 
1097
  $meta_fields = array(
40
  </div>
41
 
42
  <div class="copy-to-clipboard">
43
+ <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions id='; echo "'".esc_attr($post_id)."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
44
  <p class="description"><?php echo __('PHP Code, you can use under theme .php files.','accordions'); ?></p>
45
  </div>
46
 
47
  <div class="copy-to-clipboard">
48
+ <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_pplugins id='; echo "'".esc_attr($post_id)."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
49
  <p class="description"><?php echo __('To avoid conflict, PHP code you can use under theme .php files.','accordions'); ?></p>
50
  </div>
51
 
86
  </div>
87
 
88
  <div class="copy-to-clipboard">
89
+ <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_tabs id='; echo "'".esc_attr($post_id)."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
90
  <p class="description"><?php echo __('PHP Code, you can use under theme .php files.','accordions'); ?></p>
91
  </div>
92
 
93
  <div class="copy-to-clipboard">
94
+ <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions_tabs_pplugins id='; echo "'".esc_attr($post_id)."']"; echo '"); ?>'; ?></textarea> <span class="copied"><?php echo __('Copied','accordions'); ?></span>
95
  <p class="description"><?php echo __('To avoid conflict, PHP code you can use under theme .php files.','accordions'); ?></p>
96
  </div>
97
 
1090
  <?php
1091
 
1092
 
 
 
1093
 
1094
 
1095
  $meta_fields = array(
includes/class-post-meta-accordions.php CHANGED
@@ -199,7 +199,7 @@ class class_accordions_post_meta{
199
  $data_visible = isset($tab['data_visible']) ? $tab['data_visible'] : '';
200
  $hidden = isset($tab['hidden']) ? $tab['hidden'] : false;
201
  ?>
202
- <li <?php if(!empty($data_visible)): ?> data_visible="<?php echo esc_attr($data_visible); ?>" <?php endif; ?> class="tab-nav <?php if($hidden) echo 'hidden';?> <?php if($active) echo 'active';?>" data-id="<?php echo esc_attr($id); ?>"><?php echo $title; ?></li>
203
  <?php
204
  }
205
  ?>
199
  $data_visible = isset($tab['data_visible']) ? $tab['data_visible'] : '';
200
  $hidden = isset($tab['hidden']) ? $tab['hidden'] : false;
201
  ?>
202
+ <li <?php if(!empty($data_visible)): ?> data_visible="<?php echo esc_attr($data_visible); ?>" <?php endif; ?> class="tab-nav <?php if($hidden) echo 'hidden';?> <?php if($active) echo 'active';?>" data-id="<?php echo esc_attr($id); ?>"><?php echo esc_html($title); ?></li>
203
  <?php
204
  }
205
  ?>
includes/class-settings-hook.php CHANGED
@@ -11,7 +11,6 @@ function accordions_settings_content_general(){
11
  $font_aw_version = isset($accordions_settings['font_aw_version']) ? $accordions_settings['font_aw_version'] : 'none';
12
  $accordions_preview = isset($accordions_settings['accordions_preview']) ? $accordions_settings['accordions_preview'] : 'yes';
13
 
14
- //echo '<pre>'.var_export($accordions_settings, true).'</pre>';
15
 
16
  ?>
17
  <div class="section">
@@ -123,7 +122,9 @@ function accordions_settings_content_general(){
123
  document.getElementById("dwn-btn").addEventListener("click", function(){
124
  // Generate download of hello.txt file with some content
125
  var text = document.getElementById("text-val").value;
126
- var filename = "<?php echo date('Y-m-d-h').'-'.time(); ?>.txt";
 
 
127
 
128
  download(filename, text);
129
  }, false);
@@ -311,7 +312,7 @@ if(!function_exists('accordions_settings_content_help_support')) {
311
 
312
  ?>
313
 
314
- <p class="">Please click the button bellow to reset migration data, you can start over, Please use with caution, your new migrate data will deleted. you can use default <a href="<?php echo admin_url().'export.php'; ?>">export</a> menu to take your wcps, wcps layouts data saved.</p>
315
  <p>Please <a target="_blank" href="https://www.pickplugins.com/question/accordions-latest-version-data-migration-doesnt-work-here-is-the-solution/"><b>read this</b></a> if you have any issue on data migration</p>
316
 
317
  <p class="reset-migration"><a class="button button-primary" href="<?php echo esc_url_raw($actionurl); ?>">Reset migration</a> <span style="display: none; color: #f2433f; margin: 0 5px"> Click again to confirm!</span></p>
@@ -487,7 +488,7 @@ if(!function_exists('accordions_settings_content_3rd_party_import')) {
487
 
488
  ?>
489
  <p style="color: #f00;"><i class="fas fa-spin fa-spinner"></i> Data import on process, please wait until complete.</p>
490
- <p><a href="<?php echo $url; ?>">Refresh</a> to check import stats</p>
491
 
492
 
493
 
@@ -595,12 +596,7 @@ if(!function_exists('accordions_settings_content_3rd_party_import')) {
595
  <p class=""><a class="button button-primary" href="<?php echo esc_url_raw($actionurl).'&source=ultimate-faqs'; ?>">Import data</a></p>
596
  </div>
597
 
598
- <!-- <div class="item">-->
599
- <!-- <div class="">Tab</div>-->
600
- <!-- <div class="">By themepoints</div>-->
601
- <!---->
602
- <!-- <p class=""><a class="button button-primary" href="--><?php //echo $actionurl.'&source=tabs-pro'; ?><!--">Import data</a></p>-->
603
- <!-- </div>-->
604
 
605
  <div class="item">
606
  <div class="">Accordion Shortcodes</div>
@@ -610,12 +606,7 @@ if(!function_exists('accordions_settings_content_3rd_party_import')) {
610
  </div>
611
 
612
 
613
- <!-- <div class="item">-->
614
- <!-- <div class="">Shortcodes by Angie Makes</div>-->
615
- <!-- <div class="">By Chris Baldelomar</div>-->
616
- <!---->
617
- <!-- <p class=""><a class="button button-primary" href="--><?php //echo $actionurl.'&source=wc-shortcodes'; ?><!--">Import data</a></p>-->
618
- <!-- </div>-->
619
 
620
 
621
  <div class="item">
@@ -663,9 +654,6 @@ if(!function_exists('accordions_settings_content_3rd_party_import')) {
663
 
664
  </div>
665
 
666
- <!-- <p class="">Arconix FAQ - <a class="button button-primary" href="--><?php //echo $actionurl.'&source=arconix-faq'; ?><!--">Import data</a> <span style="display: none; color: #f2433f; margin: 0 5px"> Click again to confirm!</span></p>-->
667
- <!-- <p class="">Tabs By Biplob Adhikari - <a class="button button-primary" href="--><?php //echo $actionurl.'&source=vc-tabs'; ?><!--">Import data</a> <span style="display: none; color: #f2433f; margin: 0 5px"> Click again to confirm!</span></p>-->
668
-
669
 
670
 
671
  <style type="text/css">
11
  $font_aw_version = isset($accordions_settings['font_aw_version']) ? $accordions_settings['font_aw_version'] : 'none';
12
  $accordions_preview = isset($accordions_settings['accordions_preview']) ? $accordions_settings['accordions_preview'] : 'yes';
13
 
 
14
 
15
  ?>
16
  <div class="section">
122
  document.getElementById("dwn-btn").addEventListener("click", function(){
123
  // Generate download of hello.txt file with some content
124
  var text = document.getElementById("text-val").value;
125
+
126
+
127
+ var filename = "<?php echo esc_attr(date('Y-m-d-h').'-'.time()); ?>.txt";
128
 
129
  download(filename, text);
130
  }, false);
312
 
313
  ?>
314
 
315
+ <p class="">Please click the button bellow to reset migration data, you can start over, Please use with caution, your new migrate data will deleted. you can use default <a href="<?php echo esc_url_raw(admin_url().'export.php'); ?>">export</a> menu to take your wcps, wcps layouts data saved.</p>
316
  <p>Please <a target="_blank" href="https://www.pickplugins.com/question/accordions-latest-version-data-migration-doesnt-work-here-is-the-solution/"><b>read this</b></a> if you have any issue on data migration</p>
317
 
318
  <p class="reset-migration"><a class="button button-primary" href="<?php echo esc_url_raw($actionurl); ?>">Reset migration</a> <span style="display: none; color: #f2433f; margin: 0 5px"> Click again to confirm!</span></p>
488
 
489
  ?>
490
  <p style="color: #f00;"><i class="fas fa-spin fa-spinner"></i> Data import on process, please wait until complete.</p>
491
+ <p><a href="<?php echo esc_url_raw($url); ?>">Refresh</a> to check import stats</p>
492
 
493
 
494
 
596
  <p class=""><a class="button button-primary" href="<?php echo esc_url_raw($actionurl).'&source=ultimate-faqs'; ?>">Import data</a></p>
597
  </div>
598
 
599
+
 
 
 
 
 
600
 
601
  <div class="item">
602
  <div class="">Accordion Shortcodes</div>
606
  </div>
607
 
608
 
609
+
 
 
 
 
 
610
 
611
 
612
  <div class="item">
654
 
655
  </div>
656
 
 
 
 
657
 
658
 
659
  <style type="text/css">
includes/class-settings-tabs.php CHANGED
@@ -1,319 +1,314 @@
1
  <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
 
4
- if( ! class_exists( 'settings_tabs_field' ) ) {
5
- class settings_tabs_field{
 
6
 
7
- //public $asset_dir_url = '';
8
- public $textdomain = 'settings-tabs';
9
 
10
- public function __construct(){
 
11
 
12
- // $this->asset_dir_url = isset($args['asset_dir_url']) ? $args['asset_dir_url'] : '';
13
- // $this->textdomain = isset($args['textdomain']) ? $args['textdomain'] : '';
14
 
15
- }
16
 
17
 
18
- function admin_scripts(){
 
19
 
20
 
21
- wp_enqueue_script('jquery');
22
- wp_enqueue_script('jquery-ui-sortable');
23
- wp_enqueue_script( 'jquery-ui-core' );
24
- wp_enqueue_script('jquery-ui-accordion');
25
- wp_enqueue_style( 'jquery-ui');
26
 
27
- wp_enqueue_script('wp-color-picker');
28
- wp_enqueue_style( 'wp-color-picker' );
29
 
30
 
31
- wp_enqueue_style( 'font-awesome-5' );
32
 
33
- wp_enqueue_style( 'settings-tabs' );
34
- wp_enqueue_script( 'settings-tabs' );
35
 
36
- wp_enqueue_script( 'code-editor' );
37
- wp_enqueue_style( 'code-editor' );
38
 
39
- wp_enqueue_script( 'jquery.lazy' );
40
 
41
- if (function_exists('wp_enqueue_editor')) {
42
- wp_enqueue_editor();
 
43
  }
44
 
 
 
45
 
46
- }
47
-
48
- function field_template($option){
49
-
50
- $id = isset( $option['id'] ) ? $option['id'] : "";
51
- $wraper_class = isset( $option['wraper_class'] ) ? $option['wraper_class'] : "";
52
- $conditions = isset( $option['conditions'] ) ? $option['conditions'] : array();
53
 
54
- $is_error = isset( $option['is_error'] ) ? $option['is_error'] : false;
55
- $error_details = isset( $option['error_details'] ) ? $option['error_details'] : '';
56
 
57
 
58
 
59
- if(!empty($conditions)):
60
 
61
- $depends = '';
62
 
63
- $field = isset($conditions['field']) ? $conditions['field'] :'';
64
- $cond_value = isset($conditions['value']) ? $conditions['value']: '';
65
- $type = isset($conditions['type']) ? $conditions['type'] : '';
66
- $pattern = isset($conditions['pattern']) ? $conditions['pattern'] : '';
67
- $modifier = isset($conditions['modifier']) ? $conditions['modifier'] : '';
68
- $like = isset($conditions['like']) ? $conditions['like'] : '';
69
- $strict = isset($conditions['strict']) ? $conditions['strict'] : '';
70
- $empty = isset($conditions['empty']) ? $conditions['empty'] : '';
71
- $sign = isset($conditions['sign']) ? $conditions['sign'] : '';
72
- $min = isset($conditions['min']) ? $conditions['min'] : '';
73
- $max = isset($conditions['max']) ? $conditions['max'] : '';
74
 
75
- $depends .= "{'[name=$field]':";
76
- $depends .= '{';
77
 
78
- if(!empty($type)):
79
- $depends .= "'type':";
80
- $depends .= "'".$type."'";
81
- endif;
82
 
83
- if(!empty($modifier)):
84
- $depends .= ",'modifier':";
85
- $depends .= "'".$modifier."'";
86
- endif;
87
 
88
- if(!empty($like)):
89
- $depends .= ",'like':";
90
- $depends .= "'".$like."'";
91
- endif;
92
 
93
- if(!empty($strict)):
94
- $depends .= ",'strict':";
95
- $depends .= "'".$strict."'";
96
- endif;
97
 
98
- if(!empty($empty)):
99
- $depends .= ",'empty':";
100
- $depends .= "'".$empty."'";
101
- endif;
102
 
103
- if(!empty($sign)):
104
- $depends .= ",'sign':";
105
- $depends .= "'".$sign."'";
106
- endif;
107
 
108
- if(!empty($min)):
109
- $depends .= ",'min':";
110
- $depends .= "'".$min."'";
111
- endif;
112
 
113
- if(!empty($max)):
114
- $depends .= ",'max':";
115
- $depends .= "'".$max."'";
116
- endif;
117
- if(!empty($cond_value)):
118
- $depends .= ",'value':";
119
- if(is_array($cond_value)):
120
- $count= count($cond_value);
121
- $i = 1;
122
- $depends .= "[";
123
- foreach ($cond_value as $val):
124
- $depends .= "'".$val."'";
125
- if($i<$count)
126
- $depends .= ",";
127
- $i++;
128
- endforeach;
129
- $depends .= "]";
130
- else:
131
- $depends .= "[";
132
- $depends .= "'".$cond_value."'";
133
- $depends .= "]";
134
  endif;
135
- endif;
136
- $depends .= '}}';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
- endif;
139
 
140
 
141
 
142
- ob_start();
143
 
144
- ?>
145
- <div <?php if(!empty($depends)) {?> data-depends="[<?php echo $depends; ?>]" <?php } ?> class="setting-field <?php if($is_error) echo 'field-error'; ?> <?php echo $wraper_class; ?> <?php if(!empty($depends)) echo 'dependency-field'; ?>">
146
- <div class="field-lable">%s</div>
147
- <div class="field-input">%s
148
- <p class="description">%s</p>
149
- <?php if($is_error && !empty($error_details)): ?>
150
- <p class="error-details"><i class="fas fa-exclamation-circle"></i> <?php echo $error_details; ?></p>
151
- <?php endif; ?>
152
 
 
153
  </div>
154
- </div>
155
  <?php
156
 
157
- return ob_get_clean();
158
-
159
- }
160
-
161
-
162
-
163
-
164
-
165
-
166
- function generate_field($option){
167
-
168
- $id = isset( $option['id'] ) ? $option['id'] : "";
169
- $type = isset( $option['type'] ) ? $option['type'] : "";
170
- $details = isset( $option['details'] ) ? $option['details'] : "";
171
 
172
 
173
 
174
 
175
 
176
 
177
- if( empty( $id ) ) return;
 
178
 
179
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
180
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
181
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
182
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
183
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
184
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
185
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
186
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
187
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
188
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
189
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
190
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
191
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
192
 
193
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
194
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
195
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
196
 
197
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
198
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
199
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
200
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
201
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
202
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
203
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
204
 
205
- elseif( isset($option['type']) && $option['type'] === 'option_group') $this->field_option_group( $option );
206
- elseif( isset($option['type']) && $option['type'] === 'option_group_accordion') $this->field_option_group_accordion( $option );
207
- elseif( isset($option['type']) && $option['type'] === 'wp_editor') $this->field_wp_editor( $option );
208
- elseif( isset($option['type']) && $option['type'] === 'textarea_editor') $this->field_textarea_editor( $option );
209
 
210
 
211
 
212
- elseif( isset($option['type']) && $option['type'] === $type ) do_action( "settings_tabs_field_$type", $option );
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
215
- //if( !empty( $details ) ) echo "<p class='description'>$details</p>";
 
 
216
 
 
 
 
 
 
 
 
217
 
 
 
 
 
218
 
219
 
220
 
221
- }
 
222
 
223
 
224
- public function field_option_group_accordion( $option ){
 
225
 
226
- $id = isset( $option['id'] ) ? $option['id'] : "";
227
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
228
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : false;
229
 
230
- $args_index = isset( $option['args_index'] ) ? $option['args_index'] : array();
231
- $args_index_default = isset( $option['args_index_default'] ) ? $option['args_index_default'] : array();
232
- $args_index_hide = isset( $option['args_index_hide'] ) ? $option['args_index_hide'] : array();
233
 
234
- $args_index = !empty($args_index) ? $args_index : $args_index_default;
235
 
236
- $args = isset( $option['args'] ) ? $option['args'] : array();
237
 
238
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
239
 
240
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
241
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
242
 
243
 
244
- $title = isset( $option['title'] ) ? $option['title'] : "";
245
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
246
 
247
- if($is_pro == true){
248
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
249
- }
250
 
251
 
252
- ob_start();
253
  ?>
254
- <div class="option-group-accordion-wrap" id="<?php echo $css_id; ?>">
255
- <div sortable="<?php echo ($sortable) ? 'true': 'false'; ?>" class='option-group-accordion accordion'>
256
- <?php
257
 
258
- if(!empty($args_index))
259
- foreach( $args_index as $index ):
260
 
261
- //foreach( $args as $key => $value ):
262
 
263
- $group_title = isset($args[$index]['title']) ? $args[$index]['title'] : '';
264
- $is_hide = isset($args_index_hide[$index]) ? $args_index_hide[$index] : false;
265
 
266
 
267
- //$link = $value['link'];
268
- $options = isset($args[$index]['options']) ? $args[$index]['options'] : array();
269
 
270
- ?>
271
  <div class="group">
272
  <h3 class="accordion-title">
273
 
274
 
275
- <?php if($sortable): ?>
276
  <span class="sort"><i class="fas fa-sort"></i></span>
277
  <?php endif; ?>
278
 
279
- <span class="title-text"><?php echo $group_title; ?></span>
280
  </h3>
281
  <div class="accordion-content">
282
 
283
  <?php
284
 
285
- if(!empty($options)):
286
- foreach ($options as $option):
287
-
288
- $id = isset( $option['id'] ) ? $option['id'] : "";
289
- $type = isset( $option['type'] ) ? $option['type'] : "";
290
- $details = isset( $option['details'] ) ? $option['details'] : "";
291
-
292
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
293
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
294
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
295
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
296
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
297
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
298
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
299
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
300
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
301
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
302
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
303
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
304
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
305
-
306
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
307
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
308
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
309
-
310
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
311
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
312
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
313
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
314
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
315
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
316
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
317
 
318
  endforeach;
319
  endif;
@@ -323,438 +318,433 @@ class settings_tabs_field{
323
 
324
 
325
  <?php
326
- //endforeach;
327
 
328
- endforeach;
329
 
330
 
331
- ?>
332
- </div> <!-- .option-group-accordion -->
333
- </div><!-- .option-group-accordion-wrap -->
334
 
335
  <?php
336
 
337
- $input_html = ob_get_clean();
338
-
339
- echo sprintf($field_template, $title, $input_html, $group_details);
340
 
341
-
342
- }
343
 
344
 
345
- public function field_option_group( $option ){
 
346
 
347
- $id = isset( $option['id'] ) ? $option['id'] : "";
348
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
349
- $options = isset( $option['options'] ) ? $option['options'] : array();
350
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
351
 
352
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
353
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
354
 
355
 
356
- $title = isset( $option['title'] ) ? $option['title'] : "";
357
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
358
 
359
- if($is_pro == true){
360
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
361
- }
362
 
363
 
364
- ob_start();
365
  ?>
366
- <div id="<?php echo $css_id; ?>">
367
- <?php
368
 
369
- if(!empty($options)):
370
- foreach ($options as $option):
371
-
372
- $id = isset( $option['id'] ) ? $option['id'] : "";
373
- $type = isset( $option['type'] ) ? $option['type'] : "";
374
- $details = isset( $option['details'] ) ? $option['details'] : "";
375
-
376
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
377
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
378
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
379
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
380
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
381
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
382
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
383
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
384
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
385
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
386
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
387
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
388
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
389
-
390
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
391
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
392
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
393
-
394
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
395
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
396
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
397
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
398
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
399
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
400
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
401
 
402
- endforeach;
403
- endif;
404
- ?>
405
- </div>
406
  <?php
407
 
408
- $input_html = ob_get_clean();
409
-
410
- echo sprintf($field_template, $title, $input_html, $group_details);
411
 
412
-
413
- }
414
 
415
 
416
- public function field_media( $option ){
 
417
 
418
 
419
 
420
- $id = isset( $option['id'] ) ? $option['id'] : "";
421
- if(empty($id)) return;
422
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
423
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
424
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
425
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
426
- $title = isset( $option['title'] ) ? $option['title'] : "";
427
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
428
 
429
- $details = isset( $option['details'] ) ? $option['details'] : "";
430
 
431
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
432
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
433
 
434
- $default = isset( $option['default'] ) ? $option['default'] : '';
435
- $value = isset( $option['value'] ) ? $option['value'] : '';
436
- $value = !empty($value) ? $value : $default;
437
 
438
- $media_url = wp_get_attachment_url( $value );
439
- $media_type = get_post_mime_type( $value );
440
- $media_title = !empty($value) ? get_the_title( $value ) : __('Placeholder.jpg', $this->textdomain);
441
 
442
 
443
- $media_url = !empty($media_url) ? $media_url : $default;
444
- $media_url = !empty($media_url) ? $media_url : $placeholder;
445
- $media_basename = wp_basename($media_type);
446
 
447
- $field_name = !empty( $field_name ) ? $field_name : $id;
448
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
449
 
450
 
451
 
452
- ob_start();
453
- //wp_enqueue_media();
454
 
455
  ?>
456
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-wrapper
457
- field-media-wrapper-<?php echo $css_id; ?>">
458
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;word-break: break-all;">
459
- <?php
460
 
461
- //var_dump($media_type);
462
 
463
- if( "audio/mpeg" == $media_type ){
464
  ?>
465
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
466
- <div class="media-title"><?php echo $media_title; ?></div>
467
  <?php
468
- }elseif( "images/png" == $media_type ||
469
- "image/png" == $media_type ||
470
- "images/gif" == $media_type ||
471
- "image/gif" == $media_type ||
472
- "images/jpeg" == $media_type ||
473
- "image/jpeg" == $media_type ||
474
- "images/jpg" == $media_type ||
475
- "image/jpg" == $media_type ||
476
- "images/ico" == $media_type||
477
- "image/ico" == $media_type
478
- ){
 
479
  ?>
480
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
481
- <div class="media-title"><?php echo $media_title; ?></div>
482
  <?php
483
- }else {
484
  ?>
485
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
486
- <div class="media-title"><?php echo $media_title; ?></div>
487
 
488
  <?php
489
- }
490
- ?>
 
 
 
 
 
491
  </div>
492
- <input class="media-input-value" type="hidden" name="<?php echo esc_attr($field_name); ?>" id="media_input_<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
493
- <div class="media-upload button" id="media_upload_<?php echo esc_attr($css_id); ?>"><?php echo __('Upload', $this->textdomain);?></div>
494
- <div placeholder="<?php echo esc_attr($placeholder); ?>" class="clear button" id="media_clear_<?php echo esc_attr($css_id); ?>"><?php echo __('Clear', $this->textdomain);?></div>
495
- <div class="error-mgs"></div>
496
- </div>
497
 
498
  <?php
499
 
500
 
501
- $input_html = ob_get_clean();
502
-
503
- echo sprintf($field_template, $title, $input_html, $details);
504
 
505
- }
 
506
 
507
 
508
 
509
 
510
- public function field_media_url( $option ){
 
511
 
512
 
513
 
514
- $id = isset( $option['id'] ) ? $option['id'] : "";
515
- if(empty($id)) return;
516
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
517
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
518
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
519
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
520
- $placeholder_img = isset( $option['placeholder_img'] ) ? $option['placeholder_img'] : "";
521
 
522
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
523
- $title = isset( $option['title'] ) ? $option['title'] : "";
524
- $details = isset( $option['details'] ) ? $option['details'] : "";
525
 
526
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
527
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
528
 
529
- $default = isset( $option['default'] ) ? $option['default'] : '';
530
- $value = isset( $option['value'] ) ? $option['value'] : '';
531
- $value = !empty($value) ? $value : $default;
532
 
533
- $media_url = $value;
534
- $media_type = get_post_mime_type( $value );
535
- $media_title= get_the_title( $value );
536
- $media_url = !empty($media_url) ? $media_url : '';
537
- $media_url = !empty($media_url) ? $media_url : $placeholder_img;
538
 
539
- $field_name = !empty( $field_name ) ? $field_name : $id;
540
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
541
 
542
 
543
- wp_enqueue_media();
544
- ob_start();
545
 
546
 
547
  ?>
548
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-url-wrapper
549
- field-media-wrapper-<?php echo $css_id; ?>">
550
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;">
551
- <?php
552
 
553
- if( "audio/mpeg" == $media_type ){
554
  ?>
555
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
556
 
557
  <?php
558
- }
559
- elseif( "images/png" == $media_type || "images/jpg" == $media_type || "images/jpeg" == $media_type ||
560
- "images/gif" == $media_type ||
561
- "images/ico" == $media_type){
 
562
  ?>
563
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
564
 
565
  <?php
566
- }
567
-
568
- else {
569
  ?>
570
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
571
 
572
  <?php
573
- }
574
- ?>
 
 
 
 
 
575
  </div>
576
- <input type="text" placeholder="<?php echo esc_attr($placeholder); ?>" name="<?php echo esc_attr($field_name); ?>" id="media_input_<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
577
- <div class="media-upload button" id="media_upload_<?php echo esc_attr($css_id); ?>"><?php echo __('Upload', $this->textdomain);?></div>
578
- <div class="clear button" id="media_clear_<?php echo esc_attr($css_id); ?>"><?php echo __('Clear','post-grid');?></div>
579
- <div class="error-mgs"></div>
580
- </div>
581
 
582
  <?php
583
 
584
 
585
- $input_html = ob_get_clean();
586
-
587
- echo sprintf($field_template, $title, $input_html, $details);
588
 
589
- }
 
590
 
591
 
592
 
593
- public function field_repeatable( $option ){
 
594
 
595
- $id = isset( $option['id'] ) ? $option['id'] : "";
596
- if(empty($id)) return;
597
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
598
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
599
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
600
- $field_name = !empty( $parent ) ? $parent.'['.$field_name.']' : $field_name;
601
 
602
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
603
- $collapsible = isset( $option['collapsible'] ) ? $option['collapsible'] : true;
604
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
605
- $values = isset( $option['value'] ) ? $option['value'] : array();
606
- $fields = isset( $option['fields'] ) ? $option['fields'] : array();
607
- $title_field = isset( $option['title_field'] ) ? $option['title_field'] : '';
608
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
609
- $limit = isset( $option['limit'] ) ? $option['limit'] : '';
610
 
611
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
612
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
613
 
614
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
615
- $title = isset( $option['title'] ) ? $option['title'] : "";
616
- $details = isset( $option['details'] ) ? $option['details'] : "";
617
 
618
- $settings_tabs_field = new settings_tabs_field();
619
 
620
 
621
- ob_start();
622
  ?>
623
- <div class="item-wrap collapsible">
624
- <div class="header">
625
- <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
626
- <?php
627
- if($sortable):
628
  ?>
629
- <span class="sort" ><i class="fas fa-arrows-alt"></i></span>
 
 
 
 
 
630
  <?php
631
- endif;
632
- ?>
633
- <span class="title-text">#TIMEINDEX</span>
634
- </div>
635
- <?php
636
 
637
 
638
- if(!empty($fields)):
639
- foreach ($fields as $field):
640
 
641
- $fieldType = isset($field['type']) ? $field['type'] : '';
642
- $field['parent'] = $field_name.'[TIMEINDEX]';
643
 
644
 
645
- ?>
646
- <div class="item">
647
- <?php if($collapsible):?>
648
- <div class="content">
 
 
 
 
 
 
 
649
  <?php endif; ?>
650
 
651
- <?php
652
- $settings_tabs_field->generate_field($field);
653
- ?>
654
- <?php if($collapsible):?>
655
  </div>
656
- <?php endif; ?>
657
-
658
- </div>
659
  <?php
660
 
661
- endforeach;
662
- endif;
663
- ?>
664
- </div>
665
- <?php
666
 
667
- $fieldHtml = ob_get_clean();
668
 
669
- $fieldHtml = preg_replace("/[\r\n]+/", "\n", $fieldHtml);
670
- $fieldHtml = preg_replace("/\s+/", ' ', $fieldHtml);
671
 
672
 
673
- ob_start();
674
- ?>
675
 
676
 
677
- <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
678
- field-repeatable-wrapper-<?php echo $css_id; ?>">
679
- <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add','post-grid'); ?></div>
680
- <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
681
- <?php
682
- if(!empty($values)):
683
- $count = 1;
684
- foreach ($values as $index=>$val):
685
- $title_field_val = !empty($val[$title_field]) ? $val[$title_field] : '#'.$count;
686
 
687
- //var_dump($index);
688
 
689
- ?>
690
- <div class="item-wrap <?php if($collapsible) echo 'collapsible'; ?>" index="<?php echo $index; ?>">
691
- <?php if($collapsible):?>
692
- <div class="header">
693
- <?php endif; ?>
694
- <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
695
- <?php if($sortable):?>
696
- <span class="sort"><i class="fas fa-arrows-alt"></i></span>
 
 
 
 
 
697
  <?php endif; ?>
698
-
699
- <span class="title-text"><?php echo $title_field_val; ?></span>
700
- <?php if($collapsible):?>
701
- </div>
702
- <?php endif; ?>
703
- <?php
704
 
705
 
706
 
707
- foreach ($fields as $field_index => $field):
708
- $fieldId = $field['id'];
709
- $field_css_id = isset($field['css_id']) ? str_replace('TIMEINDEX', $index, $field['css_id']) : '';
710
 
711
- //var_dump($field_css_id);
712
 
713
- $title_field_class = ($title_field == $field_index) ? 'title-field':'';
714
  ?>
715
- <div class="item <?php echo $title_field_class; ?>">
716
- <?php if($collapsible):?>
717
- <div class="content">
718
- <?php endif; ?>
719
 
720
- <?php
721
- $field['parent'] = $field_name.'['.$index.']';
722
- $field['css_id'] = $field_css_id;
723
 
724
- $field['value'] = isset($val[$fieldId]) ? $val[$fieldId] : '';
725
 
726
- $settings_tabs_field->generate_field($field);
727
 
728
 
729
- if($collapsible):?>
 
 
730
  </div>
731
- <?php endif; ?>
732
- </div>
733
- <?php
734
 
735
- endforeach; ?>
736
- </div>
737
  <?php
738
- $count++;
739
- endforeach;
740
- else:
 
 
 
741
  ?>
742
- <?php
743
- endif;
744
- ?>
745
  </div>
746
- <div class="error-mgs"></div>
747
- </div>
748
 
749
  <?php
750
 
751
- $input_html = ob_get_clean();
752
-
753
- echo sprintf($field_template, $title, $input_html, $details);
754
-
755
 
756
-
757
- }
758
 
759
 
760
 
@@ -763,1086 +753,1086 @@ class settings_tabs_field{
763
 
764
 
765
 
766
- public function field_select( $option ){
 
767
 
768
- $id = isset( $option['id'] ) ? $option['id'] : "";
769
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
770
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
771
- $args = isset( $option['args'] ) ? $option['args'] : array();
772
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
773
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : false;
774
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
775
 
776
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
777
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
778
 
779
 
780
- $title = isset( $option['title'] ) ? $option['title'] : "";
781
- $details = isset( $option['details'] ) ? $option['details'] : "";
782
 
783
- if($is_pro == true){
784
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
785
- }
786
 
787
 
788
- if($multiple){
789
- $value = isset( $option['value'] ) ? $option['value'] : array();
790
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
791
- $default = isset( $option['default'] ) ? $option['default'] : array();
792
- }else{
793
- $value = isset( $option['value'] ) ? $option['value'] : '';
794
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
795
- $default = isset( $option['default'] ) ? $option['default'] : '';
796
- }
797
 
798
 
799
- $value = !empty($value) ? $value : $default;
800
 
801
 
802
 
803
 
804
- ob_start();
805
  ?>
806
 
807
- <select <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
808
- <?php
809
- foreach( $args as $key => $name ):
810
- if($multiple){
811
- $selected = in_array($key, $value) ? "selected" : "";
812
- }else{
813
- $selected = $value == $key ? "selected" : "";
814
- }
815
 
816
 
817
  ?>
818
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
 
 
 
 
819
  <?php
820
- endforeach;
821
  ?>
822
- </select>
823
- <?php
824
- if($multiple):
825
  ?>
826
- <div class="button select-reset">Reset</div><br>
827
- <?php
828
- endif;
829
- ?>
830
 
831
  <?php
832
 
833
- $input_html = ob_get_clean();
834
-
835
- echo sprintf($field_template, $title, $input_html, $details);
836
 
 
 
837
 
838
- }
839
-
840
- public function field_select2( $option ){
841
 
842
- $id = isset( $option['id'] ) ? $option['id'] : "";
843
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
844
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
845
- $args = isset( $option['args'] ) ? $option['args'] : array();
846
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : "";
847
- $attributes = isset( $option['attributes'] ) ? $option['attributes'] : array();
848
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
849
 
850
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
851
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
852
 
853
 
854
- //var_dump($css_id);
855
 
856
- if($multiple){
857
- $value = isset( $option['value'] ) ? $option['value'] : array();
858
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
859
- $default = isset( $option['default'] ) ? $option['default'] : array();
860
- }else{
861
- $value = isset( $option['value'] ) ? $option['value'] : '';
862
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
863
- $default = isset( $option['default'] ) ? $option['default'] : '';
864
- }
865
 
866
- $value = !empty($value) ? $value : $default;
867
 
868
- //$value = get_post_meta( $post_id, $id, true );
869
- $title = isset( $option['title'] ) ? $option['title'] : "";
870
- $details = isset( $option['details'] ) ? $option['details'] : "";
871
 
872
- $attributes_html = '';
873
 
874
- foreach ($attributes as $attributeId=>$attribute):
875
 
876
- $attributes_html = $attributeId.'='.$attribute.' ';
877
 
878
- endforeach;
879
 
880
 
881
- ob_start();
882
  ?>
883
- <select <?php echo $attributes_html; ?> class="select2" <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
884
- <?php
885
- foreach( $args as $key => $name ):
886
 
887
- if($multiple){
888
- $selected = in_array($key, $value) ? "selected" : "";
889
- }else{
890
- $selected = ($key == $value) ? "selected" : "";
891
- }
892
 
893
  ?>
894
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
895
- <?php
896
- endforeach;
897
- ?>
898
- </select>
899
  <?php
900
 
901
- $input_html = ob_get_clean();
902
 
903
- echo sprintf($field_template, $title, $input_html, $details);
 
904
 
905
 
906
 
907
 
908
 
909
- }
 
910
 
 
 
 
 
911
 
 
 
912
 
 
913
 
 
 
 
914
 
915
- public function field_text_multi( $option ){
916
 
917
- $id = isset( $option['id'] ) ? $option['id'] : "";
918
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
919
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
920
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
921
 
922
- $default = isset( $option['default'] ) ? $option['default'] : array();
923
- $values = isset( $option['value'] ) ? $option['value'] : $default;
924
 
925
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
 
926
 
927
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
928
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
929
- $allow_clone = isset( $option['allow_clone'] ) ? $option['allow_clone'] : false;
930
 
 
931
 
932
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
933
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
934
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
 
936
- $title = isset( $option['title'] ) ? $option['title'] : "";
937
- $details = isset( $option['details'] ) ? $option['details'] : "";
 
938
 
939
- if($is_pro == true){
940
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
941
- }
942
 
943
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
 
944
 
 
 
 
 
 
 
945
 
946
- ob_start();
947
- ?>
948
- <div id="input-wrapper-<?php echo $id; ?>" class="input-wrapper input-text-multi-wrapper
949
- input-text-multi-wrapper-<?php echo $css_id; ?>">
950
- <span data-placeholder="<?php echo esc_attr($placeholder); ?>" data-sort="<?php echo $sortable; ?>" data-clone="<?php echo $allow_clone; ?>" data-name="<?php echo $field_name; ?>[]" class="button add-item"><?php echo __('Add', $this->textdomain); ?></span>
951
- <div class="field-list <?php if($sortable){ echo 'sortable'; }?>" id="<?php echo $css_id; ?>">
952
- <?php
953
- if(!empty($values)):
954
- foreach ($values as $value):
955
  ?>
956
  <div class="item">
957
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
958
- echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
959
 
960
- <?php if($allow_clone):?>
961
  <span class="button clone"><i class="far fa-clone"></i></span>
962
  <?php endif; ?>
963
 
964
 
965
- <?php if($sortable):?>
966
  <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
967
  <?php endif; ?>
968
 
969
- <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
970
  </div>
971
  <?php
972
- endforeach;
973
-
974
- else:
975
 
 
976
  ?>
977
- <div class="item">
978
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
979
- echo esc_attr($placeholder); ?>" value="" />
980
-
981
- <?php if($allow_clone):?>
982
- <span class="button clone"><i class="far fa-clone"></i></span>
983
- <?php endif; ?>
984
-
985
-
986
- <?php if($sortable):?>
987
- <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
988
- <?php endif; ?>
989
 
990
- <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
991
- </div>
992
- <?php
993
 
994
- endif;
995
- ?>
996
  </div>
997
- <div class="error-mgs"></div>
998
-
999
-
1000
- </div>
1001
 
1002
  <?php
1003
 
1004
- $input_html = ob_get_clean();
1005
-
1006
- echo sprintf($field_template, $title, $input_html, $details);
1007
 
1008
- }
 
1009
 
1010
- public function field_hidden( $option ){
 
1011
 
1012
- $id = isset( $option['id'] ) ? $option['id'] : "";
1013
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1014
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1015
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1016
- $value = isset( $option['value'] ) ? $option['value'] : '';
1017
- $default = isset( $option['default'] ) ? $option['default'] : '';
1018
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1019
 
1020
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1021
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1022
 
1023
- $value = !empty($value) ? $value : $default;
1024
 
1025
- $title = isset( $option['title'] ) ? $option['title'] : "";
1026
- $details = isset( $option['details'] ) ? $option['details'] : "";
1027
 
1028
- if($is_pro == true){
1029
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1030
- }
1031
 
1032
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1033
 
1034
 
1035
- ob_start();
1036
  ?>
1037
- <input type="hidden" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1038
  <?php
1039
 
1040
- $input_html = ob_get_clean();
1041
 
1042
- echo sprintf($field_template, $title, $input_html, $details);
1043
-
1044
- }
1045
 
1046
 
1047
- public function field_text( $option ){
 
1048
 
1049
- $id = isset( $option['id'] ) ? $option['id'] : "";
1050
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1051
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1052
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1053
- $value = isset( $option['value'] ) ? $option['value'] : '';
1054
- $default = isset( $option['default'] ) ? $option['default'] : '';
1055
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1056
 
1057
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1058
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1059
 
1060
- $value = !empty($value) ? $value : $default;
1061
 
1062
- $title = isset( $option['title'] ) ? $option['title'] : "";
1063
- $details = isset( $option['details'] ) ? $option['details'] : "";
1064
 
1065
- if($is_pro == true){
1066
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1067
- }
1068
 
1069
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1070
 
1071
 
1072
- ob_start();
1073
  ?>
1074
- <input type="text" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1075
  <?php
1076
 
1077
- $input_html = ob_get_clean();
1078
-
1079
- echo sprintf($field_template, $title, $input_html, $details);
1080
 
1081
- }
 
1082
 
1083
 
1084
 
1085
- public function field_wp_editor( $option ){
 
1086
 
1087
- $id = isset( $option['id'] ) ? $option['id'] : "";
1088
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1089
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1090
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1091
- $value = isset( $option['value'] ) ? $option['value'] : '';
1092
- $default = isset( $option['default'] ) ? $option['default'] : '';
1093
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1094
 
1095
 
1096
 
1097
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1098
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1099
 
1100
- $value = !empty($value) ? $value : $default;
1101
 
1102
- $title = isset( $option['title'] ) ? $option['title'] : "";
1103
- $details = isset( $option['details'] ) ? $option['details'] : "";
1104
 
1105
- if($is_pro == true){
1106
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1107
- }
1108
 
1109
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1110
 
1111
- $editor_settings= isset( $option['editor_settings'] ) ? $option['editor_settings'] : array('textarea_name'=>$field_name, 'teeny' => true, 'textarea_rows' => 15, );
1112
 
1113
- ob_start();
1114
 
1115
  ?>
1116
- <div id="field-wrapper-<?php echo $id; ?>" class="<?php if(!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1117
- field-wp_editor-wrapper-<?php echo $id; ?>">
1118
- <?php
1119
- wp_editor( $value, $css_id, $editor_settings);
1120
- ?>
1121
- <div class="error-mgs"></div>
1122
- </div>
1123
 
1124
  <?php
1125
 
1126
 
1127
 
1128
 
1129
- $input_html = ob_get_clean();
1130
-
1131
- echo sprintf($field_template, $title, $input_html, $details);
1132
 
1133
- }
 
1134
 
1135
 
1136
 
1137
 
1138
 
1139
 
1140
- public function field_text_icon( $option ){
 
1141
 
1142
- $id = isset( $option['id'] ) ? $option['id'] : "";
1143
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1144
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1145
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1146
- $value = isset( $option['value'] ) ? $option['value'] : '';
1147
- $default = isset( $option['default'] ) ? $option['default'] : '';
1148
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1149
 
1150
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1151
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1152
 
1153
- $title = isset( $option['title'] ) ? $option['title'] : "";
1154
- $details = isset( $option['details'] ) ? $option['details'] : "";
1155
 
1156
- $option_value = empty($value) ? $default : $value;
1157
 
1158
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1159
 
1160
 
1161
 
1162
 
1163
- ob_start();
1164
  ?>
1165
- <div class="text-icon">
1166
- <span class="icon"><?php echo esc_html($option_value); ?></span><input type="text" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($option_value); ?>" />
1167
- </div>
1168
- <style type="text/css">
1169
- .text-icon{}
1170
- .text-icon .icon{
1171
- /* width: 30px; */
1172
- background: #ddd;
1173
- /* height: 28px; */
1174
- display: inline-block;
1175
- vertical-align: top;
1176
- text-align: center;
1177
- font-size: 14px;
1178
- padding: 5px 10px;
1179
- line-height: normal;
1180
- }
1181
- </style>
1182
- <script>
1183
- (function($) {
1184
-
1185
- $( document ).ready( function() {
1186
-
1187
- $(document).on("keyup", ".text-icon input", function () {
1188
- val = $(this).val();
1189
- if(val){
1190
- $(this).parent().children(".icon").html(val);
1191
- }
1192
- })
1193
- })
1194
- })(jQuery);
1195
- </script>
 
1196
  <?php
1197
 
1198
- $input_html = ob_get_clean();
1199
-
1200
- echo sprintf($field_template, $title, $input_html, $details);
1201
 
1202
- }
 
1203
 
1204
 
1205
 
1206
- public function field_range( $option ){
 
1207
 
1208
- $id = isset( $option['id'] ) ? $option['id'] : "";
1209
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1210
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1211
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1212
 
1213
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1214
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1215
 
1216
- $value = isset( $option['value'] ) ? $option['value'] : '';
1217
- $default = isset( $option['default'] ) ? $option['default'] : '';
1218
- $value = !empty($value) ? $value : $default;
1219
 
1220
- $args = isset( $option['args'] ) ? $option['args'] : "";
1221
 
1222
- $min = isset($args['min']) ? $args['min'] : '';
1223
- $max = isset($args['max']) ? $args['max'] : '';
1224
- $step = isset($args['step']) ? $args['step'] : '';
1225
 
1226
- $title = isset( $option['title'] ) ? $option['title'] : "";
1227
- $details = isset( $option['details'] ) ? $option['details'] : "";
1228
 
1229
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1230
 
1231
 
1232
- ob_start();
1233
  ?>
1234
- <div class="range-input">
1235
- <span class="range-value"><?php echo esc_html($value); ?></span><input type="range" min="<?php if($min) echo esc_attr($min); ?>" max="<?php if($max) echo esc_attr($max); ?>" step="<?php if($step) echo esc_attr($step); ?>" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
1236
- </div>
1237
-
1238
- <script>
1239
- (function($) {
1240
-
1241
- $( document ).ready( function() {
1242
- $(document).on("change", "#<?php echo $css_id; ?>", function () {
1243
- val = $(this).val();
1244
- if(val){
1245
- $(this).parent().children(".range-value").html(val);
1246
- }
1247
- })
1248
- })})(jQuery);
1249
- </script>
1250
-
1251
- <style type="text/css">
1252
- .range-input{}
1253
- .range-input .range-value{
1254
- display: inline-block;
1255
- vertical-align: top;
1256
- margin: 0 0;
1257
- padding: 4px 10px;
1258
- background: #eee;
1259
- }
1260
- </style>
 
 
1261
  <?php
1262
 
1263
- $input_html = ob_get_clean();
1264
- echo sprintf($field_template, $title, $input_html, $details);
1265
- }
1266
 
1267
 
1268
 
1269
- public function field_textarea( $option ){
 
1270
 
1271
- $id = isset( $option['id'] ) ? $option['id'] : "";
1272
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1273
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1274
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1275
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1276
- $value = isset( $option['value'] ) ? $option['value'] : '';
1277
- $default = isset( $option['default'] ) ? $option['default'] : '';
1278
- $value = !empty($value) ? $value : $default;
1279
 
1280
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1281
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1282
 
1283
- $title = isset( $option['title'] ) ? $option['title'] : "";
1284
- $details = isset( $option['details'] ) ? $option['details'] : "";
1285
 
1286
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1287
 
1288
- if($is_pro == true){
1289
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1290
- }
1291
 
1292
 
1293
- ob_start();
1294
  ?>
1295
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1296
  <?php
1297
 
1298
- $input_html = ob_get_clean();
1299
-
1300
- echo sprintf($field_template, $title, $input_html, $details);
1301
 
1302
- }
 
1303
 
1304
 
1305
 
1306
- public function field_textarea_editor( $option ){
 
1307
 
1308
- $id = isset( $option['id'] ) ? $option['id'] : "";
1309
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1310
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1311
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1312
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1313
- $value = isset( $option['value'] ) ? $option['value'] : '';
1314
- $default = isset( $option['default'] ) ? $option['default'] : '';
1315
- $value = !empty($value) ? $value : $default;
1316
 
1317
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1318
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1319
 
1320
- $title = isset( $option['title'] ) ? $option['title'] : "";
1321
- $details = isset( $option['details'] ) ? $option['details'] : "";
1322
 
1323
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1324
 
1325
- if($is_pro == true){
1326
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1327
- }
1328
 
1329
 
1330
- ob_start();
1331
  ?>
1332
- <textarea editor_enabled="no" class="textarea-editor" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1333
  <?php
1334
 
1335
- $input_html = ob_get_clean();
1336
-
1337
- echo sprintf($field_template, $title, $input_html, $details);
1338
 
1339
- }
 
1340
 
1341
 
1342
 
1343
- public function field_scripts_js( $option ){
 
1344
 
1345
- $id = isset( $option['id'] ) ? $option['id'] : "";
1346
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1347
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1348
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1349
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1350
- $value = isset( $option['value'] ) ? $option['value'] : '';
1351
- $default = isset( $option['default'] ) ? $option['default'] : '';
1352
- $value = !empty($value) ? $value : $default;
1353
 
1354
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1355
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1356
 
1357
- $title = isset( $option['title'] ) ? $option['title'] : "";
1358
- $details = isset( $option['details'] ) ? $option['details'] : "";
1359
 
1360
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1361
 
1362
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/javascript' ) );
1363
- $code_editor = wp_json_encode( $settings );
1364
 
1365
 
1366
- ob_start();
1367
  ?>
1368
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1369
 
1370
- <script>
1371
- (function($) {
1372
 
1373
- $( document ).ready( function() {
1374
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1375
- })
1376
- })(jQuery);
1377
- </script>
1378
  <?php
1379
 
1380
- $input_html = ob_get_clean();
1381
-
1382
- echo sprintf($field_template, $title, $input_html, $details);
1383
-
1384
 
 
 
1385
 
1386
 
1387
- }
1388
-
1389
-
1390
- public function field_scripts_css( $option ){
1391
 
1392
- $id = isset( $option['id'] ) ? $option['id'] : "";
1393
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1394
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1395
 
1396
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1397
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1398
- $value = isset( $option['value'] ) ? $option['value'] : '';
1399
- $default = isset( $option['default'] ) ? $option['default'] : '';
1400
- $value = !empty($value) ? $value : $default;
1401
 
1402
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1403
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1404
 
1405
- $title = isset( $option['title'] ) ? $option['title'] : "";
1406
- $details = isset( $option['details'] ) ? $option['details'] : "";
1407
 
1408
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
1409
- $code_editor = wp_json_encode( $settings );
1410
 
1411
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1412
  ?>
1413
 
1414
- <?php
1415
-
1416
- ob_start();
1417
- ?>
1418
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1419
- <script>
1420
-
1421
-
1422
- (function($) {
1423
-
1424
- $( document ).ready( function() {
1425
-
1426
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1427
 
 
 
 
 
 
1428
 
1429
- })
1430
- })(jQuery);
1431
 
 
1432
 
1433
 
1434
- </script>
 
 
1435
  <?php
1436
 
1437
- $input_html = ob_get_clean();
1438
-
1439
- echo sprintf($field_template, $title, $input_html, $details);
1440
 
1441
- }
 
1442
 
1443
 
1444
 
1445
 
1446
 
1447
- public function field_checkbox( $option ){
 
1448
 
1449
- $id = isset( $option['id'] ) ? $option['id'] : "";
1450
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1451
- $title = isset( $option['title'] ) ? $option['title'] : "";
1452
- $details = isset( $option['details'] ) ? $option['details'] : "";
1453
- $for = isset( $option['for'] ) ? $option['for'] : "";
1454
- $args = isset( $option['args'] ) ? $option['args'] : array();
1455
 
1456
- $style = isset( $option['style'] ) ? $option['style'] : array();
1457
- $style_inline = isset( $style['inline'] ) ? $style['inline'] : true;
1458
 
1459
 
1460
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1461
- $default = isset( $option['default'] ) ? $option['default'] : '';
1462
- $option_value = !empty($option_value) ? $option_value : $default;
1463
 
1464
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1465
 
1466
 
1467
 
1468
  ?>
1469
- <div class="setting-field">
1470
- <div class="field-lable"><?php if(!empty($title)) echo $title; ?></div>
1471
- <div class="field-input">
1472
- <?php
1473
 
1474
 
1475
 
1476
- if(!empty($args))
1477
- foreach( $args as $key => $value ):
1478
 
1479
 
1480
- //$checked = ( $key == $option_value ) ? "checked" : "";
1481
- $checked = in_array($key, $option_value) ? "checked" : "";
1482
 
1483
- $for = !empty($for) ? $for.'-'.$id."-".$key : $id."-".$key;
1484
 
1485
 
1486
- ?>
1487
- <label for='<?php echo esc_attr($for);?>'><input name='<?php echo esc_attr($field_name); ?>[]' type='checkbox' id='<?php echo esc_attr($for); ?>' value='<?php echo esc_attr($key);?>' <?php echo esc_attr($checked);?>><span><?php echo esc_html($value);?></span></label>
1488
 
1489
  <?php
1490
 
1491
- if(!$style_inline){
1492
- ?>
1493
  <br>
1494
- <?php
1495
- }
1496
 
1497
- endforeach;
1498
 
1499
- ?>
1500
- <p class="description"><?php if(!empty($details)) echo $details; ?></p>
 
1501
  </div>
1502
- </div>
1503
- <?php
1504
-
1505
-
1506
- }
1507
 
1508
 
 
1509
 
1510
- public function field_radio( $option ){
1511
 
1512
- $id = isset( $option['id'] ) ? $option['id'] : "";
1513
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1514
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1515
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1516
- $title = isset( $option['title'] ) ? $option['title'] : "";
1517
- $details = isset( $option['details'] ) ? $option['details'] : "";
1518
- $for = isset( $option['for'] ) ? $option['for'] : "";
1519
- $args = isset( $option['args'] ) ? $option['args'] : array();
1520
 
1521
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1522
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1523
 
1524
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1525
- $default = isset( $option['default'] ) ? $option['default'] : '';
1526
- $option_value = !empty($option_value) ? $option_value : $default;
 
 
 
 
 
1527
 
1528
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
1529
 
 
 
 
1530
 
1531
- ob_start();
1532
 
1533
- if(!empty($args))
1534
- foreach( $args as $key => $value ):
1535
- $checked = ( $key == $option_value ) ? "checked" : "";
1536
- $for = !empty($for) ? $for.'-'.$css_id."-".$key : $css_id."-".$key;
1537
- ?>
1538
- <label for="<?php echo esc_attr($for);?>"><input name="<?php echo esc_attr($field_name); ?>" type="radio" id="<?php echo esc_attr($for); ?>" value="<?php echo esc_attr($key);?>" <?php echo esc_attr($checked);?>><span><?php echo esc_html($value);?></span></label>
1539
 
1540
- <?php
1541
- endforeach;
1542
 
1543
- $input_html = ob_get_clean();
 
 
 
 
 
1544
 
1545
- echo sprintf($field_template, $title, $input_html, $details);
 
1546
 
 
1547
 
1548
- }
 
1549
 
1550
 
1551
 
1552
- public function field_radio_image( $option ){
 
1553
 
1554
- $id = isset( $option['id'] ) ? $option['id'] : "";
1555
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1556
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1557
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1558
- $args = isset( $option['args'] ) ? $option['args'] : array();
1559
- //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1560
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1561
- $default = isset( $option['default'] ) ? $option['default'] : '';
1562
- $lazy_load_img = isset( $option['lazy_load_img'] ) ? $option['lazy_load_img'] : '';
1563
 
1564
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1565
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1566
 
1567
- $title = isset( $option['title'] ) ? $option['title'] : "";
1568
- $details = isset( $option['details'] ) ? $option['details'] : "";
1569
- $width = isset( $option['width'] ) ? $option['width'] : "250px";
1570
 
1571
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1572
 
1573
- //var_dump($option_value);
1574
 
1575
- $option_value = empty($option_value) ? $default : $option_value;
1576
 
1577
 
1578
 
1579
- ob_start();
1580
- ?>
1581
- <div class="radio-img">
1582
- <?php
1583
- foreach( $args as $key => $value ):
1584
 
1585
- $name = $value['name'];
1586
- $thumb = $value['thumb'];
1587
- $disabled = isset($value['disabled']) ? $value['disabled'] : '';
1588
- $pro_msg = isset($value['pro_msg']) ? $value['pro_msg'] : '';
1589
- $link = isset($value['link']) ? $value['link'] : '';
1590
- $link_text = isset($value['link_text']) ? $value['link_text'] : 'Go';
1591
 
1592
- $checked = ($key == $option_value) ? "checked" : "";
1593
 
1594
- //var_dump($checked);
1595
 
1596
  ?>
1597
- <label style="width: <?php echo esc_attr($width); ?>;" title="<?php echo esc_attr($name); ?>" class="<?php if($checked =='checked') echo 'active';?> <?php if($disabled == true) echo 'disabled';?>">
1598
- <input <?php if($disabled) echo 'disabled'; ?> name="<?php echo esc_attr($field_name); ?>" type="radio" id="<?php echo esc_attr($css_id); ?>-<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($key); ?>" <?php echo esc_attr($checked); ?>>
1599
 
1600
- <?php
1601
- if(!empty($thumb)):
1602
 
1603
  ?>
1604
- <img class="lazy" alt="<?php echo $name; ?>" data-src="<?php echo $thumb; ?>" src="<?php echo $lazy_load_img; ?>">
1605
- <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1606
 
1607
  <?php
1608
- else:
1609
- echo $name;
1610
- endif;
1611
- ?>
1612
-
1613
- <?php if($disabled == true):?>
1614
- <span class="pro-msg"><?php echo $pro_msg; ?></span>
1615
- <?php endif; ?>
1616
- <?php if(!empty($link)):?>
1617
- <a target="_blank" class="link" href="<?php echo $link; ?>"><?php echo $link_text; ?></a>
1618
- <?php endif; ?>
1619
-
1620
- </label>
1621
- <?php
1622
-
1623
- endforeach;
1624
- ?>
1625
- </div>
1626
-
1627
- <style type="text/css">
1628
- .radio-img{}
1629
- .radio-img label{
1630
- display: inline-block;
1631
- vertical-align: top;
1632
- margin: 5px;
1633
- padding: 2px;
1634
- background: #eee;
1635
- position: relative;
1636
- }
1637
-
1638
- .radio-img label.active{
1639
- background: #fd730d;
1640
- }
1641
-
1642
- .radio-img label.disabled{
1643
- background: #e2e2e2;
1644
-
1645
- }
1646
- .radio-img label.disabled img{
1647
- background: #e2e2e2;
1648
- opacity: .3;
1649
- }
1650
-
1651
- .radio-img label.disabled .pro-msg{
1652
- background: #ffd87f;
1653
- position: absolute;
1654
- top: 50%;
1655
- left: 50%;
1656
- transform: translate(-50%,-50%);
1657
- padding: 0 10px;
1658
-
1659
- }
1660
-
1661
- .radio-img label .link{
1662
- background: hsl(200, 7%, 42%);
1663
- position: absolute;
1664
- top: 2px;
1665
- /* transform: translate(0%,-50%); */
1666
- padding: 3px 14px;
1667
- text-decoration: none;
1668
- font-size: 14px;
1669
- color: #fff;
1670
- right: 2px;
1671
-
1672
- }
1673
 
 
 
 
 
 
 
1674
 
1675
- .radio-img input[type=radio]{
1676
- display: none;
1677
- }
1678
- .radio-img img{
1679
 
1680
- vertical-align: top;
1681
- width: 100%;
1682
- }
1683
 
1684
- </style>
1685
- <?php
1686
 
1687
- $input_html = ob_get_clean();
 
 
 
 
 
 
 
1688
 
1689
- echo sprintf($field_template, $title, $input_html, $details);
 
 
1690
 
 
 
1691
 
1692
- }
1693
 
1694
- public function field_datepicker( $option ){
 
 
 
1695
 
1696
- $id = isset( $option['id'] ) ? $option['id'] : "";
1697
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1698
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1699
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1700
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1701
- $format = isset( $option['format'] ) ? $option['format'] : "";
 
1702
 
1703
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1704
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1705
 
1706
- $value = isset( $option['value'] ) ? $option['value'] : '';
1707
- $default = isset( $option['default'] ) ? $option['default'] : '';
1708
- $value = !empty($value) ? $value : $default;
 
 
 
 
 
 
 
1709
 
1710
- $title = isset( $option['title'] ) ? $option['title'] : "";
1711
- $details = isset( $option['details'] ) ? $option['details'] : "";
1712
 
1713
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1714
 
 
 
 
1715
 
1716
- wp_enqueue_script('jquery-ui-datepicker');
1717
- wp_enqueue_style( 'jquery-ui');
1718
 
1719
- ob_start();
1720
- ?>
1721
- <input type="text" autocomplete="off" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1722
- <script>(function($) {
1723
-
1724
- $( document ).ready( function() {$("#<?php echo $css_id; ?>").datepicker({ dateFormat: "<?php echo $format; ?>" });});})(jQuery);</script>
1725
  <?php
1726
 
1727
- $input_html = ob_get_clean();
1728
 
1729
- echo sprintf($field_template, $title, $input_html, $details);
1730
- }
1731
 
 
 
1732
 
 
 
 
 
 
 
1733
 
1734
- public function field_colorpicker( $option ){
 
1735
 
1736
- $id = isset( $option['id'] ) ? $option['id'] : "";
1737
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1738
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1739
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1740
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1741
 
1742
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1743
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1744
 
1745
- $value = isset( $option['value'] ) ? $option['value'] : '';
1746
- $default = isset( $option['default'] ) ? $option['default'] : '';
1747
- $value = !empty($value) ? $value : $default;
1748
 
1749
- $title = isset( $option['title'] ) ? $option['title'] : "";
1750
- $details = isset( $option['details'] ) ? $option['details'] : "";
1751
 
1752
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
1753
 
1754
- ob_start();
1755
  ?>
1756
- <input colorPicker="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
 
 
 
 
 
 
 
 
 
 
1757
  <?php
1758
 
1759
- $input_html = ob_get_clean();
1760
 
1761
- echo sprintf($field_template, $title, $input_html, $details);
1762
- }
1763
 
1764
 
1765
- public function field_colorpicker_multi( $option ){
1766
 
1767
- $id = isset( $option['id'] ) ? $option['id'] : "";
1768
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1769
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1770
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1771
- $args = isset( $option['args'] ) ? $option['args'] : "";
1772
 
 
 
 
 
 
1773
 
1774
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1775
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1776
 
1777
- $value = isset( $option['value'] ) ? $option['value'] : '';
1778
- $default = isset( $option['default'] ) ? $option['default'] : '';
1779
- $value = !empty($value) ? $value : $default;
1780
 
1781
- $title = isset( $option['title'] ) ? $option['title'] : "";
1782
- $details = isset( $option['details'] ) ? $option['details'] : "";
1783
 
1784
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1785
 
 
 
 
 
1786
 
 
1787
 
1788
- //echo '<pre>'.var_export($args, true).'</pre>';
 
1789
 
1790
- ob_start();
1791
 
1792
- if(!empty($args)):
 
1793
 
1794
- foreach ($args as $arg_key => $arg):
 
 
 
 
1795
 
1796
- $item_value = isset($value[$arg_key]) ? $value[$arg_key] : $arg;
1797
 
 
 
1798
 
1799
- ?>
1800
- <div class="">
1801
- <span><?php echo $arg_key; ?></span>
1802
- <input name="<?php echo esc_attr($field_name); ?>[<?php echo esc_attr($arg_key); ?>]" id="<?php echo esc_attr($arg_key).'-'.esc_attr($css_id); ?>" value="<?php echo esc_attr($item_value); ?>" />
1803
- <script>(function($) {
1804
 
1805
- $( document ).ready( function() { $("#<?php echo $arg_key.'-'.$css_id; ?>").wpColorPicker();});})(jQuery);</script>
1806
- </div>
1807
 
1808
- <?php
1809
- endforeach;
1810
 
1811
- endif;
1812
 
1813
 
1814
- $input_html = ob_get_clean();
1815
 
1816
- echo sprintf($field_template, $title, $input_html, $details);
1817
- }
1818
 
 
1819
 
 
1820
 
1821
- public function field_custom_html( $option ){
1822
 
1823
- $id = isset( $option['id'] ) ? $option['id'] : "";
1824
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1825
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1826
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1827
- $html = isset( $option['html'] ) ? $option['html'] : "";
1828
 
1829
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1830
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
 
 
 
 
 
 
 
 
 
 
 
1831
 
1832
- $title = isset( $option['title'] ) ? $option['title'] : "";
1833
- $details = isset( $option['details'] ) ? $option['details'] : "";
1834
 
 
1835
 
1836
- echo sprintf($field_template, $title, $html, $details);
1837
 
 
1838
 
 
 
1839
 
1840
 
1841
 
 
 
1842
 
 
 
 
 
 
1843
 
1844
- }
 
1845
 
 
 
1846
 
1847
 
1848
- }}
 
 
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit; // if direct access
3
 
4
+ if (!class_exists('settings_tabs_field')) {
5
+ class settings_tabs_field
6
+ {
7
 
8
+ //public $asset_dir_url = '';
9
+ public $textdomain = 'settings-tabs';
10
 
11
+ public function __construct()
12
+ {
13
 
14
+ // $this->asset_dir_url = isset($args['asset_dir_url']) ? $args['asset_dir_url'] : '';
15
+ // $this->textdomain = isset($args['textdomain']) ? $args['textdomain'] : '';
16
 
17
+ }
18
 
19
 
20
+ function admin_scripts()
21
+ {
22
 
23
 
24
+ wp_enqueue_script('jquery');
25
+ wp_enqueue_script('jquery-ui-sortable');
26
+ wp_enqueue_script('jquery-ui-core');
27
+ wp_enqueue_script('jquery-ui-accordion');
28
+ wp_enqueue_style('jquery-ui');
29
 
30
+ wp_enqueue_script('wp-color-picker');
31
+ wp_enqueue_style('wp-color-picker');
32
 
33
 
34
+ wp_enqueue_style('font-awesome-5');
35
 
36
+ wp_enqueue_style('settings-tabs');
37
+ wp_enqueue_script('settings-tabs');
38
 
39
+ wp_enqueue_script('code-editor');
40
+ wp_enqueue_style('code-editor');
41
 
42
+ wp_enqueue_script('jquery.lazy');
43
 
44
+ if (function_exists('wp_enqueue_editor')) {
45
+ wp_enqueue_editor();
46
+ }
47
  }
48
 
49
+ function field_template($option)
50
+ {
51
 
52
+ $id = isset($option['id']) ? $option['id'] : "";
53
+ $wraper_class = isset($option['wraper_class']) ? $option['wraper_class'] : "";
54
+ $conditions = isset($option['conditions']) ? $option['conditions'] : array();
 
 
 
 
55
 
56
+ $is_error = isset($option['is_error']) ? $option['is_error'] : false;
57
+ $error_details = isset($option['error_details']) ? $option['error_details'] : '';
58
 
59
 
60
 
61
+ if (!empty($conditions)) :
62
 
63
+ $depends = '';
64
 
65
+ $field = isset($conditions['field']) ? $conditions['field'] : '';
66
+ $cond_value = isset($conditions['value']) ? $conditions['value'] : '';
67
+ $type = isset($conditions['type']) ? $conditions['type'] : '';
68
+ $pattern = isset($conditions['pattern']) ? $conditions['pattern'] : '';
69
+ $modifier = isset($conditions['modifier']) ? $conditions['modifier'] : '';
70
+ $like = isset($conditions['like']) ? $conditions['like'] : '';
71
+ $strict = isset($conditions['strict']) ? $conditions['strict'] : '';
72
+ $empty = isset($conditions['empty']) ? $conditions['empty'] : '';
73
+ $sign = isset($conditions['sign']) ? $conditions['sign'] : '';
74
+ $min = isset($conditions['min']) ? $conditions['min'] : '';
75
+ $max = isset($conditions['max']) ? $conditions['max'] : '';
76
 
77
+ $depends .= "{'[name=$field]':";
78
+ $depends .= '{';
79
 
80
+ if (!empty($type)) :
81
+ $depends .= "'type':";
82
+ $depends .= "'" . $type . "'";
83
+ endif;
84
 
85
+ if (!empty($modifier)) :
86
+ $depends .= ",'modifier':";
87
+ $depends .= "'" . $modifier . "'";
88
+ endif;
89
 
90
+ if (!empty($like)) :
91
+ $depends .= ",'like':";
92
+ $depends .= "'" . $like . "'";
93
+ endif;
94
 
95
+ if (!empty($strict)) :
96
+ $depends .= ",'strict':";
97
+ $depends .= "'" . $strict . "'";
98
+ endif;
99
 
100
+ if (!empty($empty)) :
101
+ $depends .= ",'empty':";
102
+ $depends .= "'" . $empty . "'";
103
+ endif;
104
 
105
+ if (!empty($sign)) :
106
+ $depends .= ",'sign':";
107
+ $depends .= "'" . $sign . "'";
108
+ endif;
109
 
110
+ if (!empty($min)) :
111
+ $depends .= ",'min':";
112
+ $depends .= "'" . $min . "'";
113
+ endif;
114
 
115
+ if (!empty($max)) :
116
+ $depends .= ",'max':";
117
+ $depends .= "'" . $max . "'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  endif;
119
+ if (!empty($cond_value)) :
120
+ $depends .= ",'value':";
121
+ if (is_array($cond_value)) :
122
+ $count = count($cond_value);
123
+ $i = 1;
124
+ $depends .= "[";
125
+ foreach ($cond_value as $val) :
126
+ $depends .= "'" . $val . "'";
127
+ if ($i < $count)
128
+ $depends .= ",";
129
+ $i++;
130
+ endforeach;
131
+ $depends .= "]";
132
+ else :
133
+ $depends .= "[";
134
+ $depends .= "'" . $cond_value . "'";
135
+ $depends .= "]";
136
+ endif;
137
+ endif;
138
+ $depends .= '}}';
139
 
140
+ endif;
141
 
142
 
143
 
144
+ ob_start();
145
 
146
+ ?>
147
+ <div <?php if (!empty($depends)) { ?> data-depends="[<?php echo esc_attr($depends); ?>]" <?php } ?> class="setting-field <?php if ($is_error) echo 'field-error'; ?> <?php echo esc_attr($wraper_class); ?> <?php if (!empty($depends)) echo 'dependency-field'; ?>">
148
+ <div class="field-lable">%s</div>
149
+ <div class="field-input">%s
150
+ <p class="description">%s</p>
151
+ <?php if ($is_error && !empty($error_details)) : ?>
152
+ <p class="error-details"><i class="fas fa-exclamation-circle"></i> <?php echo esc_html($error_details); ?></p>
153
+ <?php endif; ?>
154
 
155
+ </div>
156
  </div>
 
157
  <?php
158
 
159
+ return ob_get_clean();
160
+ }
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
 
163
 
164
 
165
 
166
 
167
+ function generate_field($option)
168
+ {
169
 
170
+ $id = isset($option['id']) ? $option['id'] : "";
171
+ $type = isset($option['type']) ? $option['type'] : "";
172
+ $details = isset($option['details']) ? $option['details'] : "";
 
 
 
 
 
 
 
 
 
 
173
 
 
 
 
174
 
 
 
 
 
 
 
 
175
 
 
 
 
 
176
 
177
 
178
 
179
+ if (empty($id)) return;
180
 
181
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
182
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
183
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
184
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
185
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
186
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
187
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
188
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
189
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
190
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
191
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
192
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
193
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
194
 
195
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
196
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
197
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
198
 
199
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
200
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
201
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
202
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
203
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
204
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
205
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
206
 
207
+ elseif (isset($option['type']) && $option['type'] === 'option_group') $this->field_option_group($option);
208
+ elseif (isset($option['type']) && $option['type'] === 'option_group_accordion') $this->field_option_group_accordion($option);
209
+ elseif (isset($option['type']) && $option['type'] === 'wp_editor') $this->field_wp_editor($option);
210
+ elseif (isset($option['type']) && $option['type'] === 'textarea_editor') $this->field_textarea_editor($option);
211
 
212
 
213
 
214
+ elseif (isset($option['type']) && $option['type'] === $type) do_action("settings_tabs_field_$type", $option);
215
+ }
216
 
217
 
218
+ public function field_option_group_accordion($option)
219
+ {
220
 
221
+ $id = isset($option['id']) ? $option['id'] : "";
222
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
223
+ $sortable = isset($option['sortable']) ? $option['sortable'] : false;
224
 
225
+ $args_index = isset($option['args_index']) ? $option['args_index'] : array();
226
+ $args_index_default = isset($option['args_index_default']) ? $option['args_index_default'] : array();
227
+ $args_index_hide = isset($option['args_index_hide']) ? $option['args_index_hide'] : array();
228
 
229
+ $args_index = !empty($args_index) ? $args_index : $args_index_default;
230
 
231
+ $args = isset($option['args']) ? $option['args'] : array();
232
 
233
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
234
 
235
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
236
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
237
 
238
 
239
+ $title = isset($option['title']) ? $option['title'] : "";
240
+ $group_details = isset($option['details']) ? $option['details'] : "";
241
 
242
+ if ($is_pro == true) {
243
+ $group_details = '<span class="pro-feature">' . $pro_text . '</span> ' . $group_details;
244
+ }
245
 
246
 
247
+ ob_start();
248
  ?>
249
+ <div class="option-group-accordion-wrap" id="<?php echo esc_attr($css_id); ?>">
250
+ <div sortable="<?php echo esc_attr(($sortable) ? 'true' : 'false'); ?>" class='option-group-accordion accordion'>
251
+ <?php
252
 
253
+ if (!empty($args_index))
254
+ foreach ($args_index as $index) :
255
 
256
+ //foreach( $args as $key => $value ):
257
 
258
+ $group_title = isset($args[$index]['title']) ? $args[$index]['title'] : '';
259
+ $is_hide = isset($args_index_hide[$index]) ? $args_index_hide[$index] : false;
260
 
261
 
262
+ //$link = $value['link'];
263
+ $options = isset($args[$index]['options']) ? $args[$index]['options'] : array();
264
 
265
+ ?>
266
  <div class="group">
267
  <h3 class="accordion-title">
268
 
269
 
270
+ <?php if ($sortable) : ?>
271
  <span class="sort"><i class="fas fa-sort"></i></span>
272
  <?php endif; ?>
273
 
274
+ <span class="title-text"><?php echo esc_html($group_title); ?></span>
275
  </h3>
276
  <div class="accordion-content">
277
 
278
  <?php
279
 
280
+ if (!empty($options)) :
281
+ foreach ($options as $option) :
282
+
283
+ $id = isset($option['id']) ? $option['id'] : "";
284
+ $type = isset($option['type']) ? $option['type'] : "";
285
+ $details = isset($option['details']) ? $option['details'] : "";
286
+
287
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
288
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
289
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
290
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
291
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
292
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
293
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
294
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
295
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
296
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
297
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
298
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
299
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
300
+
301
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
302
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
303
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
304
+
305
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
306
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
307
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
308
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
309
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
310
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
311
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
312
 
313
  endforeach;
314
  endif;
318
 
319
 
320
  <?php
321
+ //endforeach;
322
 
323
+ endforeach;
324
 
325
 
326
+ ?>
327
+ </div> <!-- .option-group-accordion -->
328
+ </div><!-- .option-group-accordion-wrap -->
329
 
330
  <?php
331
 
332
+ $input_html = ob_get_clean();
 
 
333
 
334
+ echo esc_html(sprintf($field_template, $title, $input_html, $group_details));
335
+ }
336
 
337
 
338
+ public function field_option_group($option)
339
+ {
340
 
341
+ $id = isset($option['id']) ? $option['id'] : "";
342
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
343
+ $options = isset($option['options']) ? $option['options'] : array();
344
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
345
 
346
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
347
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
348
 
349
 
350
+ $title = isset($option['title']) ? $option['title'] : "";
351
+ $group_details = isset($option['details']) ? $option['details'] : "";
352
 
353
+ if ($is_pro == true) {
354
+ $group_details = '<span class="pro-feature">' . $pro_text . '</span> ' . $group_details;
355
+ }
356
 
357
 
358
+ ob_start();
359
  ?>
360
+ <div id="<?php echo esc_attr($css_id); ?>">
361
+ <?php
362
 
363
+ if (!empty($options)) :
364
+ foreach ($options as $option) :
365
+
366
+ $id = isset($option['id']) ? $option['id'] : "";
367
+ $type = isset($option['type']) ? $option['type'] : "";
368
+ $details = isset($option['details']) ? $option['details'] : "";
369
+
370
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
371
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
372
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
373
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
374
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
375
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
376
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
377
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
378
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
379
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
380
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
381
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
382
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
383
+
384
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
385
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
386
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
387
+
388
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
389
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
390
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
391
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
392
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
393
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
394
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
395
 
396
+ endforeach;
397
+ endif;
398
+ ?>
399
+ </div>
400
  <?php
401
 
402
+ $input_html = ob_get_clean();
 
 
403
 
404
+ echo esc_html(sprintf($field_template, $title, $input_html, $group_details));
405
+ }
406
 
407
 
408
+ public function field_media($option)
409
+ {
410
 
411
 
412
 
413
+ $id = isset($option['id']) ? $option['id'] : "";
414
+ if (empty($id)) return;
415
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
416
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
417
+ $parent = isset($option['parent']) ? $option['parent'] : "";
418
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
419
+ $title = isset($option['title']) ? $option['title'] : "";
420
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
421
 
422
+ $details = isset($option['details']) ? $option['details'] : "";
423
 
424
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
425
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
426
 
427
+ $default = isset($option['default']) ? $option['default'] : '';
428
+ $value = isset($option['value']) ? $option['value'] : '';
429
+ $value = !empty($value) ? $value : $default;
430
 
431
+ $media_url = wp_get_attachment_url($value);
432
+ $media_type = get_post_mime_type($value);
433
+ $media_title = !empty($value) ? get_the_title($value) : __('Placeholder.jpg', $this->textdomain);
434
 
435
 
436
+ $media_url = !empty($media_url) ? $media_url : $default;
437
+ $media_url = !empty($media_url) ? $media_url : $placeholder;
438
+ $media_basename = wp_basename($media_type);
439
 
440
+ $field_name = !empty($field_name) ? $field_name : $id;
441
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
442
 
443
 
444
 
445
+ ob_start();
446
+ //wp_enqueue_media();
447
 
448
  ?>
449
+ <div id="input-wrapper-<?php echo esc_attr($css_id); ?>" class="input-wrapper field-media-wrapper
450
+ field-media-wrapper-<?php echo esc_attr($css_id); ?>">
451
+ <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;word-break: break-all;">
452
+ <?php
453
 
454
+ //var_dump($media_type);
455
 
456
+ if ("audio/mpeg" == $media_type) {
457
  ?>
458
+ <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
459
+ <div class="media-title"><?php echo esc_html($media_title); ?></div>
460
  <?php
461
+ } elseif (
462
+ "images/png" == $media_type ||
463
+ "image/png" == $media_type ||
464
+ "images/gif" == $media_type ||
465
+ "image/gif" == $media_type ||
466
+ "images/jpeg" == $media_type ||
467
+ "image/jpeg" == $media_type ||
468
+ "images/jpg" == $media_type ||
469
+ "image/jpg" == $media_type ||
470
+ "images/ico" == $media_type ||
471
+ "image/ico" == $media_type
472
+ ) {
473
  ?>
474
+ <img class="media-preview" src="<?php echo esc_url_raw($media_url); ?>" style="width:100%" />
475
+ <div class="media-title"><?php esc_html($media_title); ?></div>
476
  <?php
477
+ } else {
478
  ?>
479
+ <img class="media-preview" src="<?php echo esc_url_raw($media_url); ?>" style="width:100%" />
480
+ <div class="media-title"><?php esc_html($media_title); ?></div>
481
 
482
  <?php
483
+ }
484
+ ?>
485
+ </div>
486
+ <input class="media-input-value" type="hidden" name="<?php echo esc_attr($field_name); ?>" id="media_input_<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
487
+ <div class="media-upload button" id="media_upload_<?php echo esc_attr($css_id); ?>"><?php echo __('Upload', $this->textdomain); ?></div>
488
+ <div placeholder="<?php echo esc_attr($placeholder); ?>" class="clear button" id="media_clear_<?php echo esc_attr($css_id); ?>"><?php echo __('Clear', $this->textdomain); ?></div>
489
+ <div class="error-mgs"></div>
490
  </div>
 
 
 
 
 
491
 
492
  <?php
493
 
494
 
495
+ $input_html = ob_get_clean();
 
 
496
 
497
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
498
+ }
499
 
500
 
501
 
502
 
503
+ public function field_media_url($option)
504
+ {
505
 
506
 
507
 
508
+ $id = isset($option['id']) ? $option['id'] : "";
509
+ if (empty($id)) return;
510
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
511
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
512
+ $parent = isset($option['parent']) ? $option['parent'] : "";
513
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
514
+ $placeholder_img = isset($option['placeholder_img']) ? $option['placeholder_img'] : "";
515
 
516
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
517
+ $title = isset($option['title']) ? $option['title'] : "";
518
+ $details = isset($option['details']) ? $option['details'] : "";
519
 
520
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
521
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
522
 
523
+ $default = isset($option['default']) ? $option['default'] : '';
524
+ $value = isset($option['value']) ? $option['value'] : '';
525
+ $value = !empty($value) ? $value : $default;
526
 
527
+ $media_url = $value;
528
+ $media_type = get_post_mime_type($value);
529
+ $media_title = get_the_title($value);
530
+ $media_url = !empty($media_url) ? $media_url : '';
531
+ $media_url = !empty($media_url) ? $media_url : $placeholder_img;
532
 
533
+ $field_name = !empty($field_name) ? $field_name : $id;
534
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
535
 
536
 
537
+ wp_enqueue_media();
538
+ ob_start();
539
 
540
 
541
  ?>
542
+ <div id="input-wrapper-<?php echo esc_attr($css_id); ?>" class="input-wrapper field-media-url-wrapper
543
+ field-media-wrapper-<?php echo esc_attr($css_id); ?>">
544
+ <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;">
545
+ <?php
546
 
547
+ if ("audio/mpeg" == $media_type) {
548
  ?>
549
+ <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
550
 
551
  <?php
552
+ } elseif (
553
+ "images/png" == $media_type || "images/jpg" == $media_type || "images/jpeg" == $media_type ||
554
+ "images/gif" == $media_type ||
555
+ "images/ico" == $media_type
556
+ ) {
557
  ?>
558
+ <img class="media-preview" src="<?php echo esc_url_raw($media_url); ?>" style="width:100%" />
559
 
560
  <?php
561
+ } else {
 
 
562
  ?>
563
+ <img class="media-preview" src="<?php echo esc_url_raw($media_url); ?>" style="width:100%" />
564
 
565
  <?php
566
+ }
567
+ ?>
568
+ </div>
569
+ <input type="text" placeholder="<?php echo esc_attr($placeholder); ?>" name="<?php echo esc_attr($field_name); ?>" id="media_input_<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
570
+ <div class="media-upload button" id="media_upload_<?php echo esc_attr($css_id); ?>"><?php echo __('Upload', $this->textdomain); ?></div>
571
+ <div class="clear button" id="media_clear_<?php echo esc_attr($css_id); ?>"><?php echo __('Clear', 'post-grid'); ?></div>
572
+ <div class="error-mgs"></div>
573
  </div>
 
 
 
 
 
574
 
575
  <?php
576
 
577
 
578
+ $input_html = ob_get_clean();
 
 
579
 
580
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
581
+ }
582
 
583
 
584
 
585
+ public function field_repeatable($option)
586
+ {
587
 
588
+ $id = isset($option['id']) ? $option['id'] : "";
589
+ if (empty($id)) return;
590
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
591
+ $parent = isset($option['parent']) ? $option['parent'] : "";
592
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
593
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
594
 
595
+ $sortable = isset($option['sortable']) ? $option['sortable'] : true;
596
+ $collapsible = isset($option['collapsible']) ? $option['collapsible'] : true;
597
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
598
+ $values = isset($option['value']) ? $option['value'] : array();
599
+ $fields = isset($option['fields']) ? $option['fields'] : array();
600
+ $title_field = isset($option['title_field']) ? $option['title_field'] : '';
601
+ $remove_text = isset($option['remove_text']) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
602
+ $limit = isset($option['limit']) ? $option['limit'] : '';
603
 
604
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
605
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
606
 
607
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
608
+ $title = isset($option['title']) ? $option['title'] : "";
609
+ $details = isset($option['details']) ? $option['details'] : "";
610
 
611
+ $settings_tabs_field = new settings_tabs_field();
612
 
613
 
614
+ ob_start();
615
  ?>
616
+ <div class="item-wrap collapsible">
617
+ <div class="header">
618
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo esc_html($remove_text); ?></span>
619
+ <?php
620
+ if ($sortable) :
621
  ?>
622
+ <span class="sort"><i class="fas fa-arrows-alt"></i></span>
623
+ <?php
624
+ endif;
625
+ ?>
626
+ <span class="title-text">#TIMEINDEX</span>
627
+ </div>
628
  <?php
 
 
 
 
 
629
 
630
 
631
+ if (!empty($fields)) :
632
+ foreach ($fields as $field) :
633
 
634
+ $fieldType = isset($field['type']) ? $field['type'] : '';
635
+ $field['parent'] = $field_name . '[TIMEINDEX]';
636
 
637
 
638
+ ?>
639
+ <div class="item">
640
+ <?php if ($collapsible) : ?>
641
+ <div class="content">
642
+ <?php endif; ?>
643
+
644
+ <?php
645
+ $settings_tabs_field->generate_field($field);
646
+ ?>
647
+ <?php if ($collapsible) : ?>
648
+ </div>
649
  <?php endif; ?>
650
 
 
 
 
 
651
  </div>
 
 
 
652
  <?php
653
 
654
+ endforeach;
655
+ endif;
656
+ ?>
657
+ </div>
658
+ <?php
659
 
660
+ $fieldHtml = ob_get_clean();
661
 
662
+ $fieldHtml = preg_replace("/[\r\n]+/", "\n", $fieldHtml);
663
+ $fieldHtml = preg_replace("/\s+/", ' ', $fieldHtml);
664
 
665
 
666
+ ob_start();
667
+ ?>
668
 
669
 
670
+ <div id="input-wrapper-<?php echo esc_attr($css_id); ?>" class=" input-wrapper field-repeatable-wrapper
671
+ field-repeatable-wrapper-<?php echo esc_attr($css_id); ?>">
672
+ <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add', 'post-grid'); ?></div>
673
+ <div class="repeatable-field-list sortable" id="<?php echo esc_attr($css_id); ?>">
674
+ <?php
675
+ if (!empty($values)) :
676
+ $count = 1;
677
+ foreach ($values as $index => $val) :
678
+ $title_field_val = !empty($val[$title_field]) ? $val[$title_field] : '#' . $count;
679
 
680
+ //var_dump($index);
681
 
682
+ ?>
683
+ <div class="item-wrap <?php if ($collapsible) echo 'collapsible'; ?>" index="<?php echo esc_attr($index); ?>">
684
+ <?php if ($collapsible) : ?>
685
+ <div class="header">
686
+ <?php endif; ?>
687
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo esc_html($remove_text); ?></span>
688
+ <?php if ($sortable) : ?>
689
+ <span class="sort"><i class="fas fa-arrows-alt"></i></span>
690
+ <?php endif; ?>
691
+
692
+ <span class="title-text"><?php echo esc_html($title_field_val); ?></span>
693
+ <?php if ($collapsible) : ?>
694
+ </div>
695
  <?php endif; ?>
696
+ <?php
 
 
 
 
 
697
 
698
 
699
 
700
+ foreach ($fields as $field_index => $field) :
701
+ $fieldId = $field['id'];
702
+ $field_css_id = isset($field['css_id']) ? str_replace('TIMEINDEX', $index, $field['css_id']) : '';
703
 
704
+ //var_dump($field_css_id);
705
 
706
+ $title_field_class = ($title_field == $field_index) ? 'title-field' : '';
707
  ?>
708
+ <div class="item <?php echo esc_attr($title_field_class); ?>">
709
+ <?php if ($collapsible) : ?>
710
+ <div class="content">
711
+ <?php endif; ?>
712
 
713
+ <?php
714
+ $field['parent'] = $field_name . '[' . $index . ']';
715
+ $field['css_id'] = $field_css_id;
716
 
717
+ $field['value'] = isset($val[$fieldId]) ? $val[$fieldId] : '';
718
 
719
+ $settings_tabs_field->generate_field($field);
720
 
721
 
722
+ if ($collapsible) : ?>
723
+ </div>
724
+ <?php endif; ?>
725
  </div>
726
+ <?php
 
 
727
 
728
+ endforeach; ?>
729
+ </div>
730
  <?php
731
+ $count++;
732
+ endforeach;
733
+ else :
734
+ ?>
735
+ <?php
736
+ endif;
737
  ?>
738
+ </div>
739
+ <div class="error-mgs"></div>
 
740
  </div>
 
 
741
 
742
  <?php
743
 
744
+ $input_html = ob_get_clean();
 
 
 
745
 
746
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
747
+ }
748
 
749
 
750
 
753
 
754
 
755
 
756
+ public function field_select($option)
757
+ {
758
 
759
+ $id = isset($option['id']) ? $option['id'] : "";
760
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
761
+ $parent = isset($option['parent']) ? $option['parent'] : "";
762
+ $args = isset($option['args']) ? $option['args'] : array();
763
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
764
+ $multiple = isset($option['multiple']) ? $option['multiple'] : false;
765
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
766
 
767
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
768
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
769
 
770
 
771
+ $title = isset($option['title']) ? $option['title'] : "";
772
+ $details = isset($option['details']) ? $option['details'] : "";
773
 
774
+ if ($is_pro == true) {
775
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
776
+ }
777
 
778
 
779
+ if ($multiple) {
780
+ $value = isset($option['value']) ? $option['value'] : array();
781
+ $field_name = !empty($parent) ? $parent . '[' . $id . '][]' : $id . '[]';
782
+ $default = isset($option['default']) ? $option['default'] : array();
783
+ } else {
784
+ $value = isset($option['value']) ? $option['value'] : '';
785
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
786
+ $default = isset($option['default']) ? $option['default'] : '';
787
+ }
788
 
789
 
790
+ $value = !empty($value) ? $value : $default;
791
 
792
 
793
 
794
 
795
+ ob_start();
796
  ?>
797
 
798
+ <select <?php if ($multiple) echo 'multiple'; ?> name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>">
799
+ <?php
800
+ foreach ($args as $key => $name) :
801
+ if ($multiple) {
802
+ $selected = in_array($key, $value) ? "selected" : "";
803
+ } else {
804
+ $selected = $value == $key ? "selected" : "";
805
+ }
806
 
807
 
808
  ?>
809
+ <option <?php echo esc_attr($selected); ?> value="<?php echo esc_attr($key); ?>"><?php echo esc_html($name); ?></option>
810
+ <?php
811
+ endforeach;
812
+ ?>
813
+ </select>
814
  <?php
815
+ if ($multiple) :
816
  ?>
817
+ <div class="button select-reset">Reset</div><br>
818
+ <?php
819
+ endif;
820
  ?>
 
 
 
 
821
 
822
  <?php
823
 
824
+ $input_html = ob_get_clean();
 
 
825
 
826
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
827
+ }
828
 
829
+ public function field_select2($option)
830
+ {
 
831
 
832
+ $id = isset($option['id']) ? $option['id'] : "";
833
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
834
+ $parent = isset($option['parent']) ? $option['parent'] : "";
835
+ $args = isset($option['args']) ? $option['args'] : array();
836
+ $multiple = isset($option['multiple']) ? $option['multiple'] : "";
837
+ $attributes = isset($option['attributes']) ? $option['attributes'] : array();
838
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
839
 
840
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
841
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
842
 
843
 
844
+ //var_dump($css_id);
845
 
846
+ if ($multiple) {
847
+ $value = isset($option['value']) ? $option['value'] : array();
848
+ $field_name = !empty($parent) ? $parent . '[' . $id . '][]' : $id . '[]';
849
+ $default = isset($option['default']) ? $option['default'] : array();
850
+ } else {
851
+ $value = isset($option['value']) ? $option['value'] : '';
852
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
853
+ $default = isset($option['default']) ? $option['default'] : '';
854
+ }
855
 
856
+ $value = !empty($value) ? $value : $default;
857
 
858
+ //$value = get_post_meta( $post_id, $id, true );
859
+ $title = isset($option['title']) ? $option['title'] : "";
860
+ $details = isset($option['details']) ? $option['details'] : "";
861
 
862
+ $attributes_html = '';
863
 
864
+ foreach ($attributes as $attributeId => $attribute) :
865
 
866
+ $attributes_html = $attributeId . '=' . $attribute . ' ';
867
 
868
+ endforeach;
869
 
870
 
871
+ ob_start();
872
  ?>
873
+ <select <?php echo esc_attr($attributes_html); ?> class="select2" <?php if ($multiple) echo 'multiple'; ?> name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>">
874
+ <?php
875
+ foreach ($args as $key => $name) :
876
 
877
+ if ($multiple) {
878
+ $selected = in_array($key, $value) ? "selected" : "";
879
+ } else {
880
+ $selected = ($key == $value) ? "selected" : "";
881
+ }
882
 
883
  ?>
884
+ <option <?php echo esc_attr($selected); ?> value="<?php echo esc_attr($key); ?>"><?php echo esc_html($name); ?></option>
885
+ <?php
886
+ endforeach;
887
+ ?>
888
+ </select>
889
  <?php
890
 
891
+ $input_html = ob_get_clean();
892
 
893
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
894
+ }
895
 
896
 
897
 
898
 
899
 
900
+ public function field_text_multi($option)
901
+ {
902
 
903
+ $id = isset($option['id']) ? $option['id'] : "";
904
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
905
+ $parent = isset($option['parent']) ? $option['parent'] : "";
906
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
907
 
908
+ $default = isset($option['default']) ? $option['default'] : array();
909
+ $values = isset($option['value']) ? $option['value'] : $default;
910
 
911
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
912
 
913
+ $remove_text = isset($option['remove_text']) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
914
+ $sortable = isset($option['sortable']) ? $option['sortable'] : true;
915
+ $allow_clone = isset($option['allow_clone']) ? $option['allow_clone'] : false;
916
 
 
917
 
918
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
919
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
 
 
920
 
 
 
921
 
922
+ $title = isset($option['title']) ? $option['title'] : "";
923
+ $details = isset($option['details']) ? $option['details'] : "";
924
 
925
+ if ($is_pro == true) {
926
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
927
+ }
928
 
929
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
930
 
 
 
931
 
932
+ ob_start();
933
+ ?>
934
+ <div id="input-wrapper-<?php echo esc_attr($id); ?>" class="input-wrapper input-text-multi-wrapper
935
+ input-text-multi-wrapper-<?php echo esc_attr($css_id); ?>">
936
+ <span data-placeholder="<?php echo esc_attr($placeholder); ?>" data-sort="<?php echo esc_attr($sortable); ?>" data-clone="<?php echo esc_attr($allow_clone); ?>" data-name="<?php echo esc_attr($field_name); ?>[]" class="button add-item"><?php echo __('Add', $this->textdomain); ?></span>
937
+ <div class="field-list <?php if ($sortable) {
938
+ echo 'sortable';
939
+ } ?>" id="<?php echo esc_attr($css_id); ?>">
940
+ <?php
941
+ if (!empty($values)) :
942
+ foreach ($values as $value) :
943
+ ?>
944
+ <div class="item">
945
+ <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
946
+ echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
947
 
948
+ <?php if ($allow_clone) : ?>
949
+ <span class="button clone"><i class="far fa-clone"></i></span>
950
+ <?php endif; ?>
951
 
 
 
 
952
 
953
+ <?php if ($sortable) : ?>
954
+ <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
955
+ <?php endif; ?>
956
 
957
+ <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo (esc_html($remove_text)); ?></span>
958
+ </div>
959
+ <?php
960
+ endforeach;
961
+
962
+ else :
963
 
 
 
 
 
 
 
 
 
 
964
  ?>
965
  <div class="item">
966
+ <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
967
+ echo esc_attr($placeholder); ?>" value="" />
968
 
969
+ <?php if ($allow_clone) : ?>
970
  <span class="button clone"><i class="far fa-clone"></i></span>
971
  <?php endif; ?>
972
 
973
 
974
+ <?php if ($sortable) : ?>
975
  <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
976
  <?php endif; ?>
977
 
978
+ <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo esc_html($remove_text); ?></span>
979
  </div>
980
  <?php
 
 
 
981
 
982
+ endif;
983
  ?>
984
+ </div>
985
+ <div class="error-mgs"></div>
 
 
 
 
 
 
 
 
 
 
986
 
 
 
 
987
 
 
 
988
  </div>
 
 
 
 
989
 
990
  <?php
991
 
992
+ $input_html = ob_get_clean();
 
 
993
 
994
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
995
+ }
996
 
997
+ public function field_hidden($option)
998
+ {
999
 
1000
+ $id = isset($option['id']) ? $option['id'] : "";
1001
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1002
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1003
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1004
+ $value = isset($option['value']) ? $option['value'] : '';
1005
+ $default = isset($option['default']) ? $option['default'] : '';
1006
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1007
 
1008
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1009
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1010
 
1011
+ $value = !empty($value) ? $value : $default;
1012
 
1013
+ $title = isset($option['title']) ? $option['title'] : "";
1014
+ $details = isset($option['details']) ? $option['details'] : "";
1015
 
1016
+ if ($is_pro == true) {
1017
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1018
+ }
1019
 
1020
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1021
 
1022
 
1023
+ ob_start();
1024
  ?>
1025
+ <input type="hidden" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1026
  <?php
1027
 
1028
+ $input_html = ob_get_clean();
1029
 
1030
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1031
+ }
 
1032
 
1033
 
1034
+ public function field_text($option)
1035
+ {
1036
 
1037
+ $id = isset($option['id']) ? $option['id'] : "";
1038
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1039
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1040
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1041
+ $value = isset($option['value']) ? $option['value'] : '';
1042
+ $default = isset($option['default']) ? $option['default'] : '';
1043
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1044
 
1045
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1046
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1047
 
1048
+ $value = !empty($value) ? $value : $default;
1049
 
1050
+ $title = isset($option['title']) ? $option['title'] : "";
1051
+ $details = isset($option['details']) ? $option['details'] : "";
1052
 
1053
+ if ($is_pro == true) {
1054
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1055
+ }
1056
 
1057
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1058
 
1059
 
1060
+ ob_start();
1061
  ?>
1062
+ <input type="text" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1063
  <?php
1064
 
1065
+ $input_html = ob_get_clean();
 
 
1066
 
1067
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1068
+ }
1069
 
1070
 
1071
 
1072
+ public function field_wp_editor($option)
1073
+ {
1074
 
1075
+ $id = isset($option['id']) ? $option['id'] : "";
1076
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1077
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1078
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1079
+ $value = isset($option['value']) ? $option['value'] : '';
1080
+ $default = isset($option['default']) ? $option['default'] : '';
1081
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1082
 
1083
 
1084
 
1085
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1086
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1087
 
1088
+ $value = !empty($value) ? $value : $default;
1089
 
1090
+ $title = isset($option['title']) ? $option['title'] : "";
1091
+ $details = isset($option['details']) ? $option['details'] : "";
1092
 
1093
+ if ($is_pro == true) {
1094
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1095
+ }
1096
 
1097
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1098
 
1099
+ $editor_settings = isset($option['editor_settings']) ? $option['editor_settings'] : array('textarea_name' => $field_name, 'teeny' => true, 'textarea_rows' => 15,);
1100
 
1101
+ ob_start();
1102
 
1103
  ?>
1104
+ <div id="field-wrapper-<?php echo esc_attr($id); ?>" class="<?php if (!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1105
+ field-wp_editor-wrapper-<?php echo esc_attr($id); ?>">
1106
+ <?php
1107
+ wp_editor($value, $css_id, $editor_settings);
1108
+ ?>
1109
+ <div class="error-mgs"></div>
1110
+ </div>
1111
 
1112
  <?php
1113
 
1114
 
1115
 
1116
 
1117
+ $input_html = ob_get_clean();
 
 
1118
 
1119
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1120
+ }
1121
 
1122
 
1123
 
1124
 
1125
 
1126
 
1127
+ public function field_text_icon($option)
1128
+ {
1129
 
1130
+ $id = isset($option['id']) ? $option['id'] : "";
1131
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1132
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1133
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1134
+ $value = isset($option['value']) ? $option['value'] : '';
1135
+ $default = isset($option['default']) ? $option['default'] : '';
1136
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1137
 
1138
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1139
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1140
 
1141
+ $title = isset($option['title']) ? $option['title'] : "";
1142
+ $details = isset($option['details']) ? $option['details'] : "";
1143
 
1144
+ $option_value = empty($value) ? $default : $value;
1145
 
1146
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1147
 
1148
 
1149
 
1150
 
1151
+ ob_start();
1152
  ?>
1153
+ <div class="text-icon">
1154
+ <span class="icon"><?php echo esc_html($option_value); ?></span><input type="text" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($option_value); ?>" />
1155
+ </div>
1156
+ <style type="text/css">
1157
+ .text-icon {}
1158
+
1159
+ .text-icon .icon {
1160
+ /* width: 30px; */
1161
+ background: #ddd;
1162
+ /* height: 28px; */
1163
+ display: inline-block;
1164
+ vertical-align: top;
1165
+ text-align: center;
1166
+ font-size: 14px;
1167
+ padding: 5px 10px;
1168
+ line-height: normal;
1169
+ }
1170
+ </style>
1171
+ <script>
1172
+ (function($) {
1173
+
1174
+ $(document).ready(function() {
1175
+
1176
+ $(document).on("keyup", ".text-icon input", function() {
1177
+ val = $(this).val();
1178
+ if (val) {
1179
+ $(this).parent().children(".icon").html(val);
1180
+ }
1181
+ })
1182
+ })
1183
+ })(jQuery);
1184
+ </script>
1185
  <?php
1186
 
1187
+ $input_html = ob_get_clean();
 
 
1188
 
1189
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1190
+ }
1191
 
1192
 
1193
 
1194
+ public function field_range($option)
1195
+ {
1196
 
1197
+ $id = isset($option['id']) ? $option['id'] : "";
1198
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1199
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1200
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1201
 
1202
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1203
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1204
 
1205
+ $value = isset($option['value']) ? $option['value'] : '';
1206
+ $default = isset($option['default']) ? $option['default'] : '';
1207
+ $value = !empty($value) ? $value : $default;
1208
 
1209
+ $args = isset($option['args']) ? $option['args'] : "";
1210
 
1211
+ $min = isset($args['min']) ? $args['min'] : '';
1212
+ $max = isset($args['max']) ? $args['max'] : '';
1213
+ $step = isset($args['step']) ? $args['step'] : '';
1214
 
1215
+ $title = isset($option['title']) ? $option['title'] : "";
1216
+ $details = isset($option['details']) ? $option['details'] : "";
1217
 
1218
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1219
 
1220
 
1221
+ ob_start();
1222
  ?>
1223
+ <div class="range-input">
1224
+ <span class="range-value"><?php echo esc_html($value); ?></span><input type="range" min="<?php if ($min) echo esc_attr($min); ?>" max="<?php if ($max) echo esc_attr($max); ?>" step="<?php if ($step) echo esc_attr($step); ?>" class="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" value="<?php echo esc_attr($value); ?>" />
1225
+ </div>
1226
+
1227
+ <script>
1228
+ (function($) {
1229
+
1230
+ $(document).ready(function() {
1231
+ $(document).on("change", "#<?php echo esc_attr($css_id); ?>", function() {
1232
+ val = $(this).val();
1233
+ if (val) {
1234
+ $(this).parent().children(".range-value").html(val);
1235
+ }
1236
+ })
1237
+ })
1238
+ })(jQuery);
1239
+ </script>
1240
+
1241
+ <style type="text/css">
1242
+ .range-input {}
1243
+
1244
+ .range-input .range-value {
1245
+ display: inline-block;
1246
+ vertical-align: top;
1247
+ margin: 0 0;
1248
+ padding: 4px 10px;
1249
+ background: #eee;
1250
+ }
1251
+ </style>
1252
  <?php
1253
 
1254
+ $input_html = ob_get_clean();
1255
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1256
+ }
1257
 
1258
 
1259
 
1260
+ public function field_textarea($option)
1261
+ {
1262
 
1263
+ $id = isset($option['id']) ? $option['id'] : "";
1264
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1265
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1266
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1267
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1268
+ $value = isset($option['value']) ? $option['value'] : '';
1269
+ $default = isset($option['default']) ? $option['default'] : '';
1270
+ $value = !empty($value) ? $value : $default;
1271
 
1272
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1273
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1274
 
1275
+ $title = isset($option['title']) ? $option['title'] : "";
1276
+ $details = isset($option['details']) ? $option['details'] : "";
1277
 
1278
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1279
 
1280
+ if ($is_pro == true) {
1281
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1282
+ }
1283
 
1284
 
1285
+ ob_start();
1286
  ?>
1287
+ <textarea name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" cols="40" rows="5" placeholder="<?php echo esc_attr($placeholder); ?>"><?php echo esc_textarea($value); ?></textarea>
1288
  <?php
1289
 
1290
+ $input_html = ob_get_clean();
 
 
1291
 
1292
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1293
+ }
1294
 
1295
 
1296
 
1297
+ public function field_textarea_editor($option)
1298
+ {
1299
 
1300
+ $id = isset($option['id']) ? $option['id'] : "";
1301
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1302
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1303
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1304
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1305
+ $value = isset($option['value']) ? $option['value'] : '';
1306
+ $default = isset($option['default']) ? $option['default'] : '';
1307
+ $value = !empty($value) ? $value : $default;
1308
 
1309
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1310
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1311
 
1312
+ $title = isset($option['title']) ? $option['title'] : "";
1313
+ $details = isset($option['details']) ? $option['details'] : "";
1314
 
1315
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1316
 
1317
+ if ($is_pro == true) {
1318
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1319
+ }
1320
 
1321
 
1322
+ ob_start();
1323
  ?>
1324
+ <textarea editor_enabled="no" class="textarea-editor" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" cols="40" rows="5" placeholder="<?php echo esc_attr($placeholder); ?>"><?php echo $value; ?></textarea>
1325
  <?php
1326
 
1327
+ $input_html = ob_get_clean();
 
 
1328
 
1329
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1330
+ }
1331
 
1332
 
1333
 
1334
+ public function field_scripts_js($option)
1335
+ {
1336
 
1337
+ $id = isset($option['id']) ? $option['id'] : "";
1338
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1339
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1340
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1341
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1342
+ $value = isset($option['value']) ? $option['value'] : '';
1343
+ $default = isset($option['default']) ? $option['default'] : '';
1344
+ $value = !empty($value) ? $value : $default;
1345
 
1346
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1347
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1348
 
1349
+ $title = isset($option['title']) ? $option['title'] : "";
1350
+ $details = isset($option['details']) ? $option['details'] : "";
1351
 
1352
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1353
 
1354
+ $settings = wp_enqueue_code_editor(array('type' => 'text/javascript'));
1355
+ $code_editor = wp_json_encode($settings);
1356
 
1357
 
1358
+ ob_start();
1359
  ?>
1360
+ <textarea name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" cols="40" rows="5" placeholder="<?php echo esc_attr($placeholder); ?>"><?php echo esc_textarea($value); ?></textarea>
1361
 
1362
+ <script>
1363
+ (function($) {
1364
 
1365
+ $(document).ready(function() {
1366
+ wp.codeEditor.initialize($('#<?php echo esc_attr($css_id); ?>'), <?php echo esc_attr($code_editor); ?>);
1367
+ })
1368
+ })(jQuery);
1369
+ </script>
1370
  <?php
1371
 
1372
+ $input_html = ob_get_clean();
 
 
 
1373
 
1374
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1375
+ }
1376
 
1377
 
1378
+ public function field_scripts_css($option)
1379
+ {
 
 
1380
 
1381
+ $id = isset($option['id']) ? $option['id'] : "";
1382
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1383
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1384
 
1385
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1386
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1387
+ $value = isset($option['value']) ? $option['value'] : '';
1388
+ $default = isset($option['default']) ? $option['default'] : '';
1389
+ $value = !empty($value) ? $value : $default;
1390
 
1391
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1392
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1393
 
1394
+ $title = isset($option['title']) ? $option['title'] : "";
1395
+ $details = isset($option['details']) ? $option['details'] : "";
1396
 
1397
+ $settings = wp_enqueue_code_editor(array('type' => 'text/css'));
1398
+ $code_editor = wp_json_encode($settings);
1399
 
1400
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1401
  ?>
1402
 
1403
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
1404
 
1405
+ ob_start();
1406
+ ?>
1407
+ <textarea name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" cols="40" rows="5" placeholder="<?php echo esc_attr($placeholder); ?>"><?php echo esc_attr($value); ?></textarea>
1408
+ <script>
1409
+ (function($) {
1410
 
1411
+ $(document).ready(function() {
 
1412
 
1413
+ wp.codeEditor.initialize($('#<?php echo esc_attr($css_id); ?>'), <?php echo esc_attr($code_editor); ?>);
1414
 
1415
 
1416
+ })
1417
+ })(jQuery);
1418
+ </script>
1419
  <?php
1420
 
1421
+ $input_html = ob_get_clean();
 
 
1422
 
1423
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1424
+ }
1425
 
1426
 
1427
 
1428
 
1429
 
1430
+ public function field_checkbox($option)
1431
+ {
1432
 
1433
+ $id = isset($option['id']) ? $option['id'] : "";
1434
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1435
+ $title = isset($option['title']) ? $option['title'] : "";
1436
+ $details = isset($option['details']) ? $option['details'] : "";
1437
+ $for = isset($option['for']) ? $option['for'] : "";
1438
+ $args = isset($option['args']) ? $option['args'] : array();
1439
 
1440
+ $style = isset($option['style']) ? $option['style'] : array();
1441
+ $style_inline = isset($style['inline']) ? $style['inline'] : true;
1442
 
1443
 
1444
+ $option_value = isset($option['value']) ? $option['value'] : '';
1445
+ $default = isset($option['default']) ? $option['default'] : '';
1446
+ $option_value = !empty($option_value) ? $option_value : $default;
1447
 
1448
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1449
 
1450
 
1451
 
1452
  ?>
1453
+ <div class="setting-field">
1454
+ <div class="field-lable"><?php if (!empty($title)) echo esc_html($title); ?></div>
1455
+ <div class="field-input">
1456
+ <?php
1457
 
1458
 
1459
 
1460
+ if (!empty($args))
1461
+ foreach ($args as $key => $value) :
1462
 
1463
 
1464
+ //$checked = ( $key == $option_value ) ? "checked" : "";
1465
+ $checked = in_array($key, $option_value) ? "checked" : "";
1466
 
1467
+ $for = !empty($for) ? $for . '-' . $id . "-" . $key : $id . "-" . $key;
1468
 
1469
 
1470
+ ?>
1471
+ <label for='<?php echo esc_attr($for); ?>'><input name='<?php echo esc_attr($field_name); ?>[]' type='checkbox' id='<?php echo esc_attr($for); ?>' value='<?php echo esc_attr($key); ?>' <?php echo esc_attr($checked); ?>><span><?php echo esc_html($value); ?></span></label>
1472
 
1473
  <?php
1474
 
1475
+ if (!$style_inline) {
1476
+ ?>
1477
  <br>
1478
+ <?php
1479
+ }
1480
 
1481
+ endforeach;
1482
 
1483
+ ?>
1484
+ <p class="description"><?php if (!empty($details)) echo esc_html($details); ?></p>
1485
+ </div>
1486
  </div>
1487
+ <?php
 
 
 
 
1488
 
1489
 
1490
+ }
1491
 
 
1492
 
 
 
 
 
 
 
 
 
1493
 
1494
+ public function field_radio($option)
1495
+ {
1496
 
1497
+ $id = isset($option['id']) ? $option['id'] : "";
1498
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1499
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1500
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1501
+ $title = isset($option['title']) ? $option['title'] : "";
1502
+ $details = isset($option['details']) ? $option['details'] : "";
1503
+ $for = isset($option['for']) ? $option['for'] : "";
1504
+ $args = isset($option['args']) ? $option['args'] : array();
1505
 
1506
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1507
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1508
 
1509
+ $option_value = isset($option['value']) ? $option['value'] : '';
1510
+ $default = isset($option['default']) ? $option['default'] : '';
1511
+ $option_value = !empty($option_value) ? $option_value : $default;
1512
 
1513
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1514
 
 
 
 
 
 
 
1515
 
1516
+ ob_start();
 
1517
 
1518
+ if (!empty($args))
1519
+ foreach ($args as $key => $value) :
1520
+ $checked = ($key == $option_value) ? "checked" : "";
1521
+ $for = !empty($for) ? $for . '-' . $css_id . "-" . $key : $css_id . "-" . $key;
1522
+ ?>
1523
+ <label for="<?php echo esc_attr($for); ?>"><input name="<?php echo esc_attr($field_name); ?>" type="radio" id="<?php echo esc_attr($for); ?>" value="<?php echo esc_attr($key); ?>" <?php echo esc_attr($checked); ?>><span><?php echo esc_html($value); ?></span></label>
1524
 
1525
+ <?php
1526
+ endforeach;
1527
 
1528
+ $input_html = ob_get_clean();
1529
 
1530
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1531
+ }
1532
 
1533
 
1534
 
1535
+ public function field_radio_image($option)
1536
+ {
1537
 
1538
+ $id = isset($option['id']) ? $option['id'] : "";
1539
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1540
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1541
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1542
+ $args = isset($option['args']) ? $option['args'] : array();
1543
+ //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1544
+ $option_value = isset($option['value']) ? $option['value'] : '';
1545
+ $default = isset($option['default']) ? $option['default'] : '';
1546
+ $lazy_load_img = isset($option['lazy_load_img']) ? $option['lazy_load_img'] : '';
1547
 
1548
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1549
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1550
 
1551
+ $title = isset($option['title']) ? $option['title'] : "";
1552
+ $details = isset($option['details']) ? $option['details'] : "";
1553
+ $width = isset($option['width']) ? $option['width'] : "250px";
1554
 
1555
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1556
 
1557
+ //var_dump($option_value);
1558
 
1559
+ $option_value = empty($option_value) ? $default : $option_value;
1560
 
1561
 
1562
 
1563
+ ob_start();
1564
+ ?>
1565
+ <div class="radio-img">
1566
+ <?php
1567
+ foreach ($args as $key => $value) :
1568
 
1569
+ $name = $value['name'];
1570
+ $thumb = $value['thumb'];
1571
+ $disabled = isset($value['disabled']) ? $value['disabled'] : '';
1572
+ $pro_msg = isset($value['pro_msg']) ? $value['pro_msg'] : '';
1573
+ $link = isset($value['link']) ? $value['link'] : '';
1574
+ $link_text = isset($value['link_text']) ? $value['link_text'] : 'Go';
1575
 
1576
+ $checked = ($key == $option_value) ? "checked" : "";
1577
 
1578
+ //var_dump($checked);
1579
 
1580
  ?>
1581
+ <label style="width: <?php echo esc_attr($width); ?>;" title="<?php echo esc_attr($name); ?>" class="<?php if ($checked == 'checked') echo 'active'; ?> <?php if ($disabled == true) echo 'disabled'; ?>">
1582
+ <input <?php if ($disabled) echo 'disabled'; ?> name="<?php echo esc_attr($field_name); ?>" type="radio" id="<?php echo esc_attr($css_id); ?>-<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($key); ?>" <?php echo esc_attr($checked); ?>>
1583
 
1584
+ <?php
1585
+ if (!empty($thumb)) :
1586
 
1587
  ?>
1588
+ <img class="lazy" alt="<?php echo $name; ?>" data-src="<?php echo esc_url_raw($thumb); ?>" src="<?php echo esc_url_raw($lazy_load_img); ?>">
1589
+ <div style="padding: 5px;" class="name"><?php echo esc_html($name); ?></div>
1590
 
1591
  <?php
1592
+ else :
1593
+ echo esc_html($name);
1594
+ endif;
1595
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1596
 
1597
+ <?php if ($disabled == true) : ?>
1598
+ <span class="pro-msg"><?php echo esc_html($pro_msg); ?></span>
1599
+ <?php endif; ?>
1600
+ <?php if (!empty($link)) : ?>
1601
+ <a target="_blank" class="link" href="<?php echo esc_url_raw($link); ?>"><?php echo esc_html($link_text); ?></a>
1602
+ <?php endif; ?>
1603
 
1604
+ </label>
1605
+ <?php
 
 
1606
 
1607
+ endforeach;
1608
+ ?>
1609
+ </div>
1610
 
1611
+ <style type="text/css">
1612
+ .radio-img {}
1613
 
1614
+ .radio-img label {
1615
+ display: inline-block;
1616
+ vertical-align: top;
1617
+ margin: 5px;
1618
+ padding: 2px;
1619
+ background: #eee;
1620
+ position: relative;
1621
+ }
1622
 
1623
+ .radio-img label.active {
1624
+ background: #fd730d;
1625
+ }
1626
 
1627
+ .radio-img label.disabled {
1628
+ background: #e2e2e2;
1629
 
1630
+ }
1631
 
1632
+ .radio-img label.disabled img {
1633
+ background: #e2e2e2;
1634
+ opacity: .3;
1635
+ }
1636
 
1637
+ .radio-img label.disabled .pro-msg {
1638
+ background: #ffd87f;
1639
+ position: absolute;
1640
+ top: 50%;
1641
+ left: 50%;
1642
+ transform: translate(-50%, -50%);
1643
+ padding: 0 10px;
1644
 
1645
+ }
 
1646
 
1647
+ .radio-img label .link {
1648
+ background: hsl(200, 7%, 42%);
1649
+ position: absolute;
1650
+ top: 2px;
1651
+ /* transform: translate(0%,-50%); */
1652
+ padding: 3px 14px;
1653
+ text-decoration: none;
1654
+ font-size: 14px;
1655
+ color: #fff;
1656
+ right: 2px;
1657
 
1658
+ }
 
1659
 
 
1660
 
1661
+ .radio-img input[type=radio] {
1662
+ display: none;
1663
+ }
1664
 
1665
+ .radio-img img {
 
1666
 
1667
+ vertical-align: top;
1668
+ width: 100%;
1669
+ }
1670
+ </style>
 
 
1671
  <?php
1672
 
1673
+ $input_html = ob_get_clean();
1674
 
1675
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1676
+ }
1677
 
1678
+ public function field_datepicker($option)
1679
+ {
1680
 
1681
+ $id = isset($option['id']) ? $option['id'] : "";
1682
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1683
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1684
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1685
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1686
+ $format = isset($option['format']) ? $option['format'] : "";
1687
 
1688
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1689
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1690
 
1691
+ $value = isset($option['value']) ? $option['value'] : '';
1692
+ $default = isset($option['default']) ? $option['default'] : '';
1693
+ $value = !empty($value) ? $value : $default;
 
 
1694
 
1695
+ $title = isset($option['title']) ? $option['title'] : "";
1696
+ $details = isset($option['details']) ? $option['details'] : "";
1697
 
1698
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
 
 
1699
 
 
 
1700
 
1701
+ wp_enqueue_script('jquery-ui-datepicker');
1702
+ wp_enqueue_style('jquery-ui');
1703
 
1704
+ ob_start();
1705
  ?>
1706
+ <input type="text" autocomplete="off" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1707
+ <script>
1708
+ (function($) {
1709
+
1710
+ $(document).ready(function() {
1711
+ $("#<?php echo esc_attr($css_id); ?>").datepicker({
1712
+ dateFormat: "<?php echo esc_attr($format); ?>"
1713
+ });
1714
+ });
1715
+ })(jQuery);
1716
+ </script>
1717
  <?php
1718
 
1719
+ $input_html = ob_get_clean();
1720
 
1721
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1722
+ }
1723
 
1724
 
 
1725
 
1726
+ public function field_colorpicker($option)
1727
+ {
 
 
 
1728
 
1729
+ $id = isset($option['id']) ? $option['id'] : "";
1730
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1731
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1732
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1733
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1734
 
1735
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1736
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1737
 
1738
+ $value = isset($option['value']) ? $option['value'] : '';
1739
+ $default = isset($option['default']) ? $option['default'] : '';
1740
+ $value = !empty($value) ? $value : $default;
1741
 
1742
+ $title = isset($option['title']) ? $option['title'] : "";
1743
+ $details = isset($option['details']) ? $option['details'] : "";
1744
 
1745
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1746
 
1747
+ ob_start();
1748
+ ?>
1749
+ <input colorPicker="" name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($css_id); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1750
+ <?php
1751
 
1752
+ $input_html = ob_get_clean();
1753
 
1754
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1755
+ }
1756
 
 
1757
 
1758
+ public function field_colorpicker_multi($option)
1759
+ {
1760
 
1761
+ $id = isset($option['id']) ? $option['id'] : "";
1762
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1763
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1764
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1765
+ $args = isset($option['args']) ? $option['args'] : "";
1766
 
 
1767
 
1768
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1769
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1770
 
1771
+ $value = isset($option['value']) ? $option['value'] : '';
1772
+ $default = isset($option['default']) ? $option['default'] : '';
1773
+ $value = !empty($value) ? $value : $default;
 
 
1774
 
1775
+ $title = isset($option['title']) ? $option['title'] : "";
1776
+ $details = isset($option['details']) ? $option['details'] : "";
1777
 
1778
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
 
1779
 
 
1780
 
1781
 
 
1782
 
1783
+ ob_start();
 
1784
 
1785
+ if (!empty($args)) :
1786
 
1787
+ foreach ($args as $arg_key => $arg) :
1788
 
1789
+ $item_value = isset($value[$arg_key]) ? $value[$arg_key] : $arg;
1790
 
 
 
 
 
 
1791
 
1792
+ ?>
1793
+ <div class="">
1794
+ <span><?php echo esc_html($arg_key); ?></span>
1795
+ <input name="<?php echo esc_attr($field_name); ?>[<?php echo esc_attr($arg_key); ?>]" id="<?php echo esc_attr($arg_key) . '-' . esc_attr($css_id); ?>" value="<?php echo esc_attr($item_value); ?>" />
1796
+ <script>
1797
+ (function($) {
1798
+
1799
+ $(document).ready(function() {
1800
+ $("#<?php echo esc_attr($arg_key . '-' . $css_id); ?>").wpColorPicker();
1801
+ });
1802
+ })(jQuery);
1803
+ </script>
1804
+ </div>
1805
 
1806
+ <?php
1807
+ endforeach;
1808
 
1809
+ endif;
1810
 
 
1811
 
1812
+ $input_html = ob_get_clean();
1813
 
1814
+ echo esc_html(sprintf($field_template, $title, $input_html, $details));
1815
+ }
1816
 
1817
 
1818
 
1819
+ public function field_custom_html($option)
1820
+ {
1821
 
1822
+ $id = isset($option['id']) ? $option['id'] : "";
1823
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1824
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1825
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1826
+ $html = isset($option['html']) ? $option['html'] : "";
1827
 
1828
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1829
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1830
 
1831
+ $title = isset($option['title']) ? $option['title'] : "";
1832
+ $details = isset($option['details']) ? $option['details'] : "";
1833
 
1834
 
1835
+ echo esc_html(sprintf($field_template, $title, $html, $details));
1836
+ }
1837
+ }
1838
+ }
includes/class-widget-accordions.php CHANGED
@@ -15,10 +15,10 @@ class WidgetAccordions extends WP_Widget {
15
  $title = apply_filters( 'widget_title', $instance['title'] );
16
  $accordion_id = isset( $instance[ 'accordion_id' ] ) ? $instance[ 'accordion_id' ] : '';
17
 
18
- echo $args['before_widget'];
19
  if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title'];
20
  echo do_shortcode("[accordions id='$accordion_id']");
21
- echo $args['after_widget'];
22
  }
23
 
24
  public function form( $instance ) {
@@ -27,23 +27,31 @@ class WidgetAccordions extends WP_Widget {
27
  $accordion_id = isset( $instance[ 'accordion_id' ] ) ? $instance[ 'accordion_id' ] : '';
28
  $accordions = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'accordions' ) );
29
 
30
- echo "<p>";
31
- echo "<label for='{$this->get_field_id( 'title' )}'>".__('Title','accordions')." : </label>";
32
- echo "<input class='widefat' id='{$this->get_field_id( 'title' )}' name='{$this->get_field_name( 'title' )}' type='text' value='{$title}' />";
33
- echo "</p>";
 
 
34
 
35
- echo "<p>";
36
- echo "<label for='{$this->get_field_id( 'accordion_id' )}'>".__('Select Accordion','accordions')." : </label>";
37
- echo "<select name='{$this->get_field_name( 'accordion_id' )}' id='{$this->get_field_id( 'accordion_id' )}' class='widefat'>";
38
 
39
- foreach( $accordions as $accordion ){
 
40
 
41
  $selected = $accordion_id == $accordion->ID ? 'selected' : '';
42
- echo "<option value='{$accordion->ID}' $selected>{$accordion->post_title}</option>";
 
 
43
  }
 
44
 
45
- echo "</select>";
46
- echo "</p>";
 
 
47
  }
48
 
49
  public function update( $new_instance, $old_instance ) {
15
  $title = apply_filters( 'widget_title', $instance['title'] );
16
  $accordion_id = isset( $instance[ 'accordion_id' ] ) ? $instance[ 'accordion_id' ] : '';
17
 
18
+ echo esc_html($args['before_widget']);
19
  if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title'];
20
  echo do_shortcode("[accordions id='$accordion_id']");
21
+ echo esc_html($args['after_widget']);
22
  }
23
 
24
  public function form( $instance ) {
27
  $accordion_id = isset( $instance[ 'accordion_id' ] ) ? $instance[ 'accordion_id' ] : '';
28
  $accordions = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'accordions' ) );
29
 
30
+ ?>
31
+
32
+ <p>
33
+ <label for=<?php echo esc_attr($this->get_field_id( 'title' )); ?>><?php echo __('Title','accordions'); ?> : </label>
34
+ <input class='widefat' id=<?php echo esc_attr($this->get_field_id( 'title' )); ?> name=<?php echo esc_attr($this->get_field_name( 'title' )); ?> type='text' value=<?php echo esc_attr($title); ?> />
35
+ </p>
36
 
37
+ <p>
38
+ <label for=<?php echo esc_attr($this->get_field_id( 'accordion_id' )); ?>><?php echo __('Select Accordion','accordions'); ?> : </label>
39
+ <select name=<?php echo esc_attr($this->get_field_name( 'accordion_id' )); ?> id=<?php echo esc_attr($this->get_field_id( 'accordion_id' )); ?> class='widefat'>
40
 
41
+ <?php
42
+ foreach( $accordions as $accordion ){
43
 
44
  $selected = $accordion_id == $accordion->ID ? 'selected' : '';
45
+ ?>
46
+ <option value=<?php echo esc_html($accordion->ID); ?> <?php echo esc_attr($selected); ?>><?php echo esc_html($accordion->post_title); ?></option>
47
+ <?php
48
  }
49
+ ?>
50
 
51
+ </select>
52
+ </p>
53
+
54
+ <?php
55
  }
56
 
57
  public function update( $new_instance, $old_instance ) {
includes/functions-data-upgrade.php CHANGED
@@ -83,7 +83,6 @@ function accordions_cron_upgrade_accordions(){
83
 
84
  $accordions_options_is_saved = get_post_meta( $accordions_id, 'accordions_options', true );
85
 
86
- //echo $accordions_title.'<br/>';
87
 
88
  $accordions_lazy_load = get_post_meta( $accordions_id, 'accordions_lazy_load', true );
89
  $accordions_options['lazy_load'] = $accordions_lazy_load;
83
 
84
  $accordions_options_is_saved = get_post_meta( $accordions_id, 'accordions_options', true );
85
 
 
86
 
87
  $accordions_lazy_load = get_post_meta( $accordions_id, 'accordions_lazy_load', true );
88
  $accordions_options['lazy_load'] = $accordions_lazy_load;
includes/functions-wc.php CHANGED
@@ -1,55 +1,55 @@
1
  <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
 
4
 
5
 
6
 
7
- add_filter( 'woocommerce_product_tabs', 'accordions_product_tab' );
8
- function accordions_product_tab( $tabs ) {
 
9
 
10
- $prouct_id = get_the_id();
11
- $accordions_id = get_post_meta( $prouct_id, 'accordions_id', true );
12
- $accordions_tab_title = get_post_meta( $prouct_id, 'accordions_tab_title', true );
13
 
14
- $accordions_tab_title = !empty($accordions_tab_title) ? $accordions_tab_title : __( 'FAQ', 'accordions' );
15
 
16
- if(!empty($accordions_id)):
17
- $tabs['accordions_faq'] = array(
18
- 'title' => esc_html($accordions_tab_title),
19
- 'priority' => 50,
20
- 'callback' => 'woo_product_tab_accordions_content'
21
- );
22
  endif;
23
 
24
 
25
- return $tabs;
26
-
27
  }
28
- function woo_product_tab_accordions_content() {
 
29
 
30
  $prouct_id = get_the_id();
31
- // The new tab content
32
- $accordions_id = get_post_meta( $prouct_id, 'accordions_id', true );
33
 
34
 
35
- if(!empty($accordions_id)):
36
- echo do_shortcode('[accordions id="'.$accordions_id.'"]');
37
  endif;
38
-
39
-
40
  }
41
 
42
- function accordions_ajax_wc_get_accordions(){
 
43
 
44
- $return = array();
45
 
46
  $nonce = isset($_GET['nonce']) ? sanitize_text_field($_GET['nonce']) : '';
47
 
48
  //error_log($nonce);
49
 
50
- if(wp_verify_nonce( $nonce, 'accordions_nonce' )) {
51
 
52
- if(current_user_can( 'manage_options' )) {
53
  // you can use WP_Query, query_posts() or get_posts() here - it doesn't matter
54
  $search_results = new WP_Query(array(
55
  's' => sanitize_text_field($_GET['q']), // the search query
@@ -67,11 +67,10 @@ function accordions_ajax_wc_get_accordions(){
67
  endif;
68
  }
69
  }
70
- echo json_encode( $return );
71
- die;
72
-
73
  }
74
 
75
 
76
  add_action('wp_ajax_accordions_ajax_wc_get_accordions', 'accordions_ajax_wc_get_accordions');
77
- add_action('wp_ajax_nopriv_accordions_ajax_wc_get_accordions', 'accordions_ajax_wc_get_accordions');
1
  <?php
2
+ if (!defined('ABSPATH')) exit; // if direct access
3
 
4
 
5
 
6
 
7
+ add_filter('woocommerce_product_tabs', 'accordions_product_tab');
8
+ function accordions_product_tab($tabs)
9
+ {
10
 
11
+ $prouct_id = get_the_id();
12
+ $accordions_id = get_post_meta($prouct_id, 'accordions_id', true);
13
+ $accordions_tab_title = get_post_meta($prouct_id, 'accordions_tab_title', true);
14
 
15
+ $accordions_tab_title = !empty($accordions_tab_title) ? $accordions_tab_title : __('FAQ', 'accordions');
16
 
17
+ if (!empty($accordions_id)) :
18
+ $tabs['accordions_faq'] = array(
19
+ 'title' => esc_html($accordions_tab_title),
20
+ 'priority' => 50,
21
+ 'callback' => 'woo_product_tab_accordions_content'
22
+ );
23
  endif;
24
 
25
 
26
+ return $tabs;
 
27
  }
28
+ function woo_product_tab_accordions_content()
29
+ {
30
 
31
  $prouct_id = get_the_id();
32
+ // The new tab content
33
+ $accordions_id = get_post_meta($prouct_id, 'accordions_id', true);
34
 
35
 
36
+ if (!empty($accordions_id)) :
37
+ echo esc_html(do_shortcode('[accordions id="' . esc_attr($accordions_id) . '"]'));
38
  endif;
 
 
39
  }
40
 
41
+ function accordions_ajax_wc_get_accordions()
42
+ {
43
 
44
+ $return = array();
45
 
46
  $nonce = isset($_GET['nonce']) ? sanitize_text_field($_GET['nonce']) : '';
47
 
48
  //error_log($nonce);
49
 
50
+ if (wp_verify_nonce($nonce, 'accordions_nonce')) {
51
 
52
+ if (current_user_can('manage_options')) {
53
  // you can use WP_Query, query_posts() or get_posts() here - it doesn't matter
54
  $search_results = new WP_Query(array(
55
  's' => sanitize_text_field($_GET['q']), // the search query
67
  endif;
68
  }
69
  }
70
+ echo json_encode($return);
71
+ die;
 
72
  }
73
 
74
 
75
  add_action('wp_ajax_accordions_ajax_wc_get_accordions', 'accordions_ajax_wc_get_accordions');
76
+ add_action('wp_ajax_nopriv_accordions_ajax_wc_get_accordions', 'accordions_ajax_wc_get_accordions');
includes/functions.php CHANGED
@@ -11,7 +11,6 @@ function accordions_all_user_roles()
11
 
12
  return $roles;
13
  // Below code will print the all list of roles.
14
- //echo '<pre>'.var_export($wp_roles, true).'</pre>';
15
 
16
  }
17
 
@@ -337,8 +336,7 @@ function accordions_get_shortcode($content)
337
  foreach ($tabs as $tab_content) {
338
 
339
  $shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag = 'restab');
340
- echo '<pre>' . var_export('#####', true) . '</pre>';
341
- echo '<pre>' . var_export($shortcode_content, true) . '</pre>';
342
  }
343
  }
344
 
@@ -400,7 +398,6 @@ function accordions_nested_shortcode_content($string, $child_tag = 'restab')
400
 
401
  $accordion_content = array();
402
 
403
- //echo '<pre>'.var_export($tabs, true).'</pre>';
404
 
405
 
406
  $tabs = explode('[' . $child_tag, $string);
@@ -430,7 +427,6 @@ function accordions_nested_shortcode_content($string, $child_tag = 'restab')
430
  $i++;
431
  }
432
 
433
- //echo '<pre>'.var_export($accordion_content, true).'</pre>';
434
 
435
 
436
 
11
 
12
  return $roles;
13
  // Below code will print the all list of roles.
 
14
 
15
  }
16
 
336
  foreach ($tabs as $tab_content) {
337
 
338
  $shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag = 'restab');
339
+
 
340
  }
341
  }
342
 
398
 
399
  $accordion_content = array();
400
 
 
401
 
402
 
403
  $tabs = explode('[' . $child_tag, $string);
427
  $i++;
428
  }
429
 
 
430
 
431
 
432
 
includes/menu/settings.php CHANGED
@@ -48,7 +48,7 @@ $accordions_settings = get_option('accordions_settings');
48
 
49
  ?>
50
  <div class="wrap">
51
- <div id="icon-tools" class="icon32"><br></div><h2><?php echo sprintf(__('%s Settings', 'accordions'), accordions_plugin_name)?></h2>
52
  <form method="post" action="<?php echo str_replace( '%7E', '~', esc_url_raw($_SERVER['REQUEST_URI'])); ?>">
53
  <input type="hidden" name="accordions_hidden" value="Y">
54
  <input type="hidden" name="tab" value="<?php echo esc_attr($current_tab); ?>">
@@ -94,10 +94,10 @@ $accordions_settings = get_option('accordions_settings');
94
  $pro_text = isset($tab['pro_text']) ? $tab['pro_text'] : '';
95
  ?>
96
  <li <?php if(!empty($data_visible)): ?> data_visible="<?php echo esc_attr($data_visible); ?>" <?php endif; ?> class="tab-nav <?php if($hidden) echo 'hidden';?> <?php if($active) echo 'active';?>" data-id="<?php echo esc_attr($id); ?>">
97
- <?php echo $title; ?>
98
  <?php
99
  if($is_pro):
100
- ?><span class="pro-feature"><?php echo $pro_text; ?></span> <?php
101
  endif;
102
  ?>
103
  </li>
48
 
49
  ?>
50
  <div class="wrap">
51
+ <div id="icon-tools" class="icon32"><br></div><h2><?php echo sprintf(__('%s Settings', 'accordions'), accordions_plugin_name); ?></h2>
52
  <form method="post" action="<?php echo str_replace( '%7E', '~', esc_url_raw($_SERVER['REQUEST_URI'])); ?>">
53
  <input type="hidden" name="accordions_hidden" value="Y">
54
  <input type="hidden" name="tab" value="<?php echo esc_attr($current_tab); ?>">
94
  $pro_text = isset($tab['pro_text']) ? $tab['pro_text'] : '';
95
  ?>
96
  <li <?php if(!empty($data_visible)): ?> data_visible="<?php echo esc_attr($data_visible); ?>" <?php endif; ?> class="tab-nav <?php if($hidden) echo 'hidden';?> <?php if($active) echo 'active';?>" data-id="<?php echo esc_attr($id); ?>">
97
+ <?php echo esc_html($title); ?>
98
  <?php
99
  if($is_pro):
100
+ ?><span class="pro-feature"><?php echo esc_html($pro_text); ?></span> <?php
101
  endif;
102
  ?>
103
  </li>
includes/menu/upgrade-status.php CHANGED
@@ -5,7 +5,6 @@ $accordions_plugin_info = get_option('accordions_plugin_info');
5
  $accordions_settings_upgrade = isset($accordions_plugin_info['settings_upgrade']) ? $accordions_plugin_info['settings_upgrade'] : '';
6
  $accordions_upgrade = isset($accordions_plugin_info['accordions_upgrade']) ? $accordions_plugin_info['accordions_upgrade'] : '';
7
 
8
- //echo '<pre>'.var_export($accordions_upgrade, true).'</pre>';
9
  wp_enqueue_style('font-awesome-5');
10
 
11
  $url = admin_url().'edit.php?post_type=accordions&page=upgrade_status';
5
  $accordions_settings_upgrade = isset($accordions_plugin_info['settings_upgrade']) ? $accordions_plugin_info['settings_upgrade'] : '';
6
  $accordions_upgrade = isset($accordions_plugin_info['accordions_upgrade']) ? $accordions_plugin_info['accordions_upgrade'] : '';
7
 
 
8
  wp_enqueue_style('font-awesome-5');
9
 
10
  $url = admin_url().'edit.php?post_type=accordions&page=upgrade_status';
readme.txt CHANGED
@@ -4,7 +4,7 @@
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
  Tested up to: 6.0
7
- Stable tag: 2.2.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -139,6 +139,11 @@ then paste this shortcode anywhere in your page to display accordions<br />
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
142
  = 2.2.44 =
143
  * 2022-08-18 - fix - custom script escape issue fixed.
144
 
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
  Tested up to: 6.0
7
+ Stable tag: 2.2.45
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
139
 
140
  == Changelog ==
141
 
142
+ = 2.2.45 =
143
+ * 2022-08-24 - fix - remove unnecessary file codemirror.js file.
144
+ * 2022-08-24 - fix - custom script escape issue fixed.
145
+
146
+
147
  = 2.2.44 =
148
  * 2022-08-18 - fix - custom script escape issue fixed.
149
 
templates/accordion/accordion-hook.php CHANGED
@@ -22,11 +22,11 @@ function accordions_main_top($atts)
22
  </div>
23
  <script>
24
  (function($) {
25
- $(window).on("load",function(){
26
  $('#accordions-lazy-<?php echo esc_attr($post_id); ?>').fadeOut();
27
  $('#accordions-<?php echo esc_attr($post_id); ?> .items').fadeIn();
28
  })
29
- })(jQuery);
30
  </script><?php
31
  endif;
32
  }
@@ -126,25 +126,28 @@ function accordions_main_top($atts)
126
  <?php endif; ?>
127
  }
128
  }
 
129
  @media only screen and (min-width: 768px) and (max-width: 1023px) {
130
  #accordions-<?php echo esc_attr($post_id); ?> {
131
  <?php if (!empty($width_medium)) : ?>width: <?php echo esc_attr($width_medium); ?>;
132
  <?php endif; ?>
133
  }
134
  }
 
135
  @media only screen and (min-width: 0px) and (max-width: 767px) {
136
  #accordions-<?php echo esc_attr($post_id); ?> {
137
  <?php if (!empty($width_small)) : ?>width: <?php echo esc_attr($width_small); ?>;
138
  <?php endif; ?>
139
  }
140
  }
 
141
  <?php
142
  if ($lazy_load == 'yes') {
143
- ?>#accordions-<?php echo esc_attr($post_id); ?> .items {
144
  display: none;
145
  }
146
 
147
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-lazy {
148
  text-align: center;
149
  position: absolute;
150
  top: 50%;
@@ -161,39 +164,37 @@ function accordions_main_top($atts)
161
  <?php endif; ?>position: relative;
162
  }
163
 
164
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-head {
165
- <?php if (!empty($header_background_color)) : ?>background: <?php echo esc_attr($header_background_color); ?> none repeat scroll 0 0;<?php endif; ?>
166
-
167
- <?php if (!empty($header_margin)) : ?>margin: <?php echo esc_attr($header_margin); ?>;<?php endif; ?>
168
-
169
- <?php if (!empty($header_padding)) : ?>padding: <?php echo esc_attr($header_padding); ?>;<?php endif; ?>
170
- outline: none;
171
  }
172
 
173
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-head-title {
174
  <?php if (!empty($header_font_family)) : ?>font-family: <?php echo esc_attr($header_font_family); ?>;
175
  <?php endif; ?><?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
176
  <?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
177
  <?php endif; ?>
178
  }
179
 
180
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-head-title-toggle {
181
  <?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
182
  <?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
183
  <?php endif; ?>
184
  }
185
 
186
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-head:hover .accordions-head-title {
187
  <?php if (!empty($header_color_hover)) : ?>color: <?php echo esc_attr($header_color_hover); ?>;
188
  <?php endif; ?>
189
  }
190
 
191
- #accordions-<?php echo esc_attr($post_id); ?> .ui-state-active {
192
  <?php if (!empty($header_active_background_color)) : ?>background: <?php echo esc_attr($header_active_background_color); ?>;
193
  <?php endif; ?>border: none;
194
  }
195
 
196
- #accordions-<?php echo esc_attr($post_id); ?> .accordion-content {
197
  <?php if (!empty($body_font_family)) : ?>font-family: <?php echo esc_attr($body_font_family); ?>;
198
  <?php endif; ?><?php if (!empty($body_background_color)) : ?>background: <?php echo esc_attr($body_background_color); ?> none repeat scroll 0 0;
199
  <?php endif; ?><?php if (!empty($body_color)) : ?>color: <?php echo esc_attr($body_color); ?>;
@@ -203,7 +204,7 @@ function accordions_main_top($atts)
203
  <?php endif; ?>border: none;
204
  }
205
 
206
- #accordions-<?php echo esc_attr($post_id); ?> .accordion-icons {
207
  <?php if (!empty($icon_color)) : ?>color: <?php echo esc_attr($icon_color); ?>;
208
  <?php endif; ?><?php if (!empty($icon_font_size)) : ?>font-size: <?php echo esc_attr($icon_font_size); ?>;
209
  <?php endif; ?><?php if (!empty($icon_background_color)) : ?>background: <?php echo esc_attr($icon_background_color); ?> none repeat scroll 0 0;
@@ -212,7 +213,7 @@ function accordions_main_top($atts)
212
  <?php endif; ?>
213
  }
214
 
215
- #accordions-<?php echo esc_attr($post_id); ?> .accordions-head:hover .accordion-icons span {
216
  <?php if (!empty($icon_color_hover)) : ?>color: <?php echo esc_attr($icon_color_hover); ?>;
217
  <?php endif; ?>
218
  }
@@ -231,8 +232,8 @@ function accordions_main_top($atts)
231
  $bg_color_css = !empty($background_color) ? $background_color : '';
232
 
233
  if (!empty($bg_color_css) || !empty($header_bg_img)) {
234
- ?>#accordions-<?php echo esc_attr($post_id); ?> #header-<?php echo esc_attr($index); ?> {
235
- background: <?php echo esc_attr($bg_color_css); ?> <?php echo $header_bg_img; ?>;
236
  }
237
 
238
  <?php
@@ -345,8 +346,8 @@ function accordions_main_top($atts)
345
  if ($icon_position == 'left') :
346
  ?>
347
  <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
348
- <span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
349
- <span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
350
  </span>
351
  <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode(htmlspecialchars_decode($accordion_header)); ?></span>
352
  <?php
@@ -354,8 +355,8 @@ function accordions_main_top($atts)
354
  ?>
355
  <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode(htmlspecialchars_decode($accordion_header)); ?></span>
356
  <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
357
- <span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
358
- <span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
359
  </span>
360
  <?php
361
  else :
@@ -378,12 +379,12 @@ function accordions_main_top($atts)
378
  ?>
379
  </div>
380
  <script>
381
- (function($) {
382
 
383
- $( document ).ready( function() {
384
- <?php
385
  if (isset($_GET['active_index'])) :
386
- $accordion_index = isset($_GET['active_index']) ? esc_attr($_GET['active_index']) : '';
387
 
388
  //var_dump($accordion_index);
389
 
@@ -397,15 +398,16 @@ function accordions_main_top($atts)
397
  foreach ($active_index as $ind) {
398
  $active_index_new[] = (int)$ind;
399
  }
400
- ?>accordions_active_index_<?php echo esc_attr($accordion_id); ?> = <?php echo json_encode($active_index_new); ?>;
401
- <?php
402
  }
403
  else :
404
- ?>accordions_active_index_<?php echo esc_attr($post_id); ?> = <?php echo json_encode($active_index); ?>;
405
- <?php
406
  endif;
407
- ?>
408
- })})(jQuery);
 
409
  </script><?php
410
 
411
 
@@ -446,12 +448,12 @@ function accordions_main_top($atts)
446
  $i++;
447
  }
448
 
449
- $html = ob_get_clean();
450
  ?><script type="application/ld+json">
451
  {
452
  "@context": "https://schema.org",
453
  "@type": "FAQPage",
454
- "mainEntity": [<?php echo $html; ?>]
455
  }
456
  </script><?php
457
 
@@ -473,7 +475,6 @@ function accordions_main_top($atts)
473
 
474
  if ($hide_edit == 'yes') return;
475
 
476
- //var_dump($hide_edit);
477
 
478
  $edit_link_access_role = isset($accordions_options['edit_link_access_role']) ? $accordions_options['edit_link_access_role'] : array('administrator');
479
 
@@ -482,12 +483,10 @@ function accordions_main_top($atts)
482
  $user = wp_get_current_user();
483
  $user_roles = !empty($user->roles) ? $user->roles : array();
484
 
485
- //echo '<pre>'.var_export($user_roles, true).'</pre>';
486
 
487
 
488
  if (!empty($edit_link_access_role))
489
  foreach ($edit_link_access_role as $role) :
490
- //echo '<pre>'.var_export($role, true).'</pre>';
491
 
492
  if (in_array($role, $user_roles)) {
493
  $admin_url = admin_url();
@@ -572,41 +571,42 @@ function accordions_main_top($atts)
572
  ?>
573
  <script>
574
  (function($) {
575
- $( document ).ready( function() {
576
- accordion_<?php echo esc_attr($post_id); ?> = $("#accordions-<?php echo esc_attr($post_id); ?> .items").accordion({
577
- event: "<?php echo esc_attr($active_event); ?>",
578
- collapsible: <?php echo esc_attr($collapsible); ?>,
579
- heightStyle: "<?php echo esc_attr($height_style); ?>",
580
- animate: ("<?php echo esc_attr($animate_style); ?>", <?php echo esc_attr($animate_delay); ?>),
581
- navigation: true,
582
- active: 999,
583
- <?php
584
- if ($expanded_other == 'yes') {
585
- ?>
586
- beforeActivate: function(event, ui) {
587
- if (ui.newHeader[0]) {
588
- var currHeader = ui.newHeader;
589
- var currContent = currHeader.next(".ui-accordion-content");
590
- } else {
591
- var currHeader = ui.oldHeader;
592
- var currContent = currHeader.next(".ui-accordion-content");
593
- }
594
- var isPanelSelected = currHeader.attr("aria-selected") == "true";
595
- currHeader.toggleClass("ui-corner-all", isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top", !isPanelSelected).attr("aria-selected", ((!isPanelSelected).toString()));
596
- currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e", isPanelSelected).toggleClass("ui-icon-triangle-1-s", !isPanelSelected);
597
- currContent.toggleClass("accordion-content-active", !isPanelSelected)
598
- if (isPanelSelected) {
599
- currContent.slideUp();
600
- } else {
601
- currContent.slideDown();
602
- }
603
- return false;
604
- },
605
- <?php
606
- }
607
- ?>
608
- });
609
- })})(jQuery);
 
610
  </script>
611
  <?php
612
 
@@ -616,9 +616,10 @@ function accordions_main_top($atts)
616
 
617
  <script>
618
  (function($) {
619
- $( document ).ready( function() {
620
- <?php echo esc_js($custom_js); ?>
621
- })})(jQuery);
 
622
  </script>
623
  <?php
624
  endif;
22
  </div>
23
  <script>
24
  (function($) {
25
+ $(window).on("load", function() {
26
  $('#accordions-lazy-<?php echo esc_attr($post_id); ?>').fadeOut();
27
  $('#accordions-<?php echo esc_attr($post_id); ?> .items').fadeIn();
28
  })
29
+ })(jQuery);
30
  </script><?php
31
  endif;
32
  }
126
  <?php endif; ?>
127
  }
128
  }
129
+
130
  @media only screen and (min-width: 768px) and (max-width: 1023px) {
131
  #accordions-<?php echo esc_attr($post_id); ?> {
132
  <?php if (!empty($width_medium)) : ?>width: <?php echo esc_attr($width_medium); ?>;
133
  <?php endif; ?>
134
  }
135
  }
136
+
137
  @media only screen and (min-width: 0px) and (max-width: 767px) {
138
  #accordions-<?php echo esc_attr($post_id); ?> {
139
  <?php if (!empty($width_small)) : ?>width: <?php echo esc_attr($width_small); ?>;
140
  <?php endif; ?>
141
  }
142
  }
143
+
144
  <?php
145
  if ($lazy_load == 'yes') {
146
+ ?>#accordions-<?php echo esc_attr($post_id); ?>.items {
147
  display: none;
148
  }
149
 
150
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-lazy {
151
  text-align: center;
152
  position: absolute;
153
  top: 50%;
164
  <?php endif; ?>position: relative;
165
  }
166
 
167
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-head {
168
+ <?php if (!empty($header_background_color)) : ?>background: <?php echo esc_attr($header_background_color); ?> none repeat scroll 0 0;
169
+ <?php endif; ?><?php if (!empty($header_margin)) : ?>margin: <?php echo esc_attr($header_margin); ?>;
170
+ <?php endif; ?><?php if (!empty($header_padding)) : ?>padding: <?php echo esc_attr($header_padding); ?>;
171
+ <?php endif; ?>outline: none;
 
 
172
  }
173
 
174
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-head-title {
175
  <?php if (!empty($header_font_family)) : ?>font-family: <?php echo esc_attr($header_font_family); ?>;
176
  <?php endif; ?><?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
177
  <?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
178
  <?php endif; ?>
179
  }
180
 
181
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-head-title-toggle {
182
  <?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
183
  <?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
184
  <?php endif; ?>
185
  }
186
 
187
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-head:hover .accordions-head-title {
188
  <?php if (!empty($header_color_hover)) : ?>color: <?php echo esc_attr($header_color_hover); ?>;
189
  <?php endif; ?>
190
  }
191
 
192
+ #accordions-<?php echo esc_attr($post_id); ?>.ui-state-active {
193
  <?php if (!empty($header_active_background_color)) : ?>background: <?php echo esc_attr($header_active_background_color); ?>;
194
  <?php endif; ?>border: none;
195
  }
196
 
197
+ #accordions-<?php echo esc_attr($post_id); ?>.accordion-content {
198
  <?php if (!empty($body_font_family)) : ?>font-family: <?php echo esc_attr($body_font_family); ?>;
199
  <?php endif; ?><?php if (!empty($body_background_color)) : ?>background: <?php echo esc_attr($body_background_color); ?> none repeat scroll 0 0;
200
  <?php endif; ?><?php if (!empty($body_color)) : ?>color: <?php echo esc_attr($body_color); ?>;
204
  <?php endif; ?>border: none;
205
  }
206
 
207
+ #accordions-<?php echo esc_attr($post_id); ?>.accordion-icons {
208
  <?php if (!empty($icon_color)) : ?>color: <?php echo esc_attr($icon_color); ?>;
209
  <?php endif; ?><?php if (!empty($icon_font_size)) : ?>font-size: <?php echo esc_attr($icon_font_size); ?>;
210
  <?php endif; ?><?php if (!empty($icon_background_color)) : ?>background: <?php echo esc_attr($icon_background_color); ?> none repeat scroll 0 0;
213
  <?php endif; ?>
214
  }
215
 
216
+ #accordions-<?php echo esc_attr($post_id); ?>.accordions-head:hover .accordion-icons span {
217
  <?php if (!empty($icon_color_hover)) : ?>color: <?php echo esc_attr($icon_color_hover); ?>;
218
  <?php endif; ?>
219
  }
232
  $bg_color_css = !empty($background_color) ? $background_color : '';
233
 
234
  if (!empty($bg_color_css) || !empty($header_bg_img)) {
235
+ ?>#accordions-<?php echo esc_attr($post_id); ?>#header-<?php echo esc_attr($index); ?> {
236
+ background: <?php echo esc_attr($bg_color_css); ?> <?php echo esc_url_raw($header_bg_img); ?>;
237
  }
238
 
239
  <?php
346
  if ($icon_position == 'left') :
347
  ?>
348
  <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
349
+ <span class="accordion-icon-active accordion-plus"><?php echo esc_html($active_icon); ?></span>
350
+ <span class="accordion-icon-inactive accordion-minus"><?php echo esc_attr($inactive_icon); ?></span>
351
  </span>
352
  <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode(htmlspecialchars_decode($accordion_header)); ?></span>
353
  <?php
355
  ?>
356
  <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode(htmlspecialchars_decode($accordion_header)); ?></span>
357
  <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
358
+ <span class="accordion-icon-active accordion-plus"><?php echo esc_html($active_icon); ?></span>
359
+ <span class="accordion-icon-inactive accordion-minus"><?php echo esc_html($inactive_icon); ?></span>
360
  </span>
361
  <?php
362
  else :
379
  ?>
380
  </div>
381
  <script>
382
+ (function($) {
383
 
384
+ $(document).ready(function() {
385
+ <?php
386
  if (isset($_GET['active_index'])) :
387
+ $accordion_index = isset($_GET['active_index']) ? absint($_GET['active_index']) : '';
388
 
389
  //var_dump($accordion_index);
390
 
398
  foreach ($active_index as $ind) {
399
  $active_index_new[] = (int)$ind;
400
  }
401
+ ?>accordions_active_index_<?php echo esc_attr($accordion_id); ?> = <?php echo json_encode($active_index_new); ?>;
402
+ <?php
403
  }
404
  else :
405
+ ?>accordions_active_index_<?php echo esc_attr($post_id); ?> = <?php echo json_encode($active_index); ?>;
406
+ <?php
407
  endif;
408
+ ?>
409
+ })
410
+ })(jQuery);
411
  </script><?php
412
 
413
 
448
  $i++;
449
  }
450
 
451
+ $json = ob_get_clean();
452
  ?><script type="application/ld+json">
453
  {
454
  "@context": "https://schema.org",
455
  "@type": "FAQPage",
456
+ "mainEntity": [<?php echo esc_attr($json); ?>]
457
  }
458
  </script><?php
459
 
475
 
476
  if ($hide_edit == 'yes') return;
477
 
 
478
 
479
  $edit_link_access_role = isset($accordions_options['edit_link_access_role']) ? $accordions_options['edit_link_access_role'] : array('administrator');
480
 
483
  $user = wp_get_current_user();
484
  $user_roles = !empty($user->roles) ? $user->roles : array();
485
 
 
486
 
487
 
488
  if (!empty($edit_link_access_role))
489
  foreach ($edit_link_access_role as $role) :
 
490
 
491
  if (in_array($role, $user_roles)) {
492
  $admin_url = admin_url();
571
  ?>
572
  <script>
573
  (function($) {
574
+ $(document).ready(function() {
575
+ accordion_<?php echo esc_attr($post_id); ?> = $("#accordions-<?php echo esc_attr($post_id); ?> .items").accordion({
576
+ event: "<?php echo esc_attr($active_event); ?>",
577
+ collapsible: <?php echo esc_attr($collapsible); ?>,
578
+ heightStyle: "<?php echo esc_attr($height_style); ?>",
579
+ animate: ("<?php echo esc_attr($animate_style); ?>", <?php echo esc_attr($animate_delay); ?>),
580
+ navigation: true,
581
+ active: 999,
582
+ <?php
583
+ if ($expanded_other == 'yes') {
584
+ ?>
585
+ beforeActivate: function(event, ui) {
586
+ if (ui.newHeader[0]) {
587
+ var currHeader = ui.newHeader;
588
+ var currContent = currHeader.next(".ui-accordion-content");
589
+ } else {
590
+ var currHeader = ui.oldHeader;
591
+ var currContent = currHeader.next(".ui-accordion-content");
592
+ }
593
+ var isPanelSelected = currHeader.attr("aria-selected") == "true";
594
+ currHeader.toggleClass("ui-corner-all", isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top", !isPanelSelected).attr("aria-selected", ((!isPanelSelected).toString()));
595
+ currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e", isPanelSelected).toggleClass("ui-icon-triangle-1-s", !isPanelSelected);
596
+ currContent.toggleClass("accordion-content-active", !isPanelSelected)
597
+ if (isPanelSelected) {
598
+ currContent.slideUp();
599
+ } else {
600
+ currContent.slideDown();
601
+ }
602
+ return false;
603
+ },
604
+ <?php
605
+ }
606
+ ?>
607
+ });
608
+ })
609
+ })(jQuery);
610
  </script>
611
  <?php
612
 
616
 
617
  <script>
618
  (function($) {
619
+ $(document).ready(function() {
620
+ <?php echo esc_js($custom_js); ?>
621
+ })
622
+ })(jQuery);
623
  </script>
624
  <?php
625
  endif;
templates/tabs/tabs-hook.php CHANGED
@@ -377,27 +377,27 @@ function accordions_tabs_main_items($atts)
377
 
378
  ob_start();
379
  ?>
380
- <li post_id="<?php echo $post_id; ?>" header_id="header-<?php echo $index; ?>" id="header-<?php echo $index; ?>" style="" class="tabs-nav head<?php echo $index; ?> <?php echo $header_class; ?>" toggle-text="<?php echo do_shortcode(esc_attr($toggled_text)); ?>" main-text="<?php echo do_shortcode(esc_attr($accordion_header)); ?>">
381
 
382
  <?php
383
  if ($icon_position == 'left') :
384
  ?>
385
 
386
- <a style="" class="accordions-tab-head" href="#tabs-<?php echo $index; ?>">
387
- <span id="accordion-icons-<?php echo $index; ?>" class="accordion-icons">
388
- <span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
389
- <span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
390
  </span>
391
- <span id="header-text-<?php echo $index; ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
392
  </a>
393
  <?php
394
  elseif ($icon_position == 'right') :
395
  ?>
396
- <a style="" class="accordions-tab-head" href="#tabs-<?php echo $index; ?>">
397
- <span id="header-text-<?php echo $index; ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
398
- <span id="accordion-icons-<?php echo $index; ?>" class="accordion-icons">
399
- <span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
400
- <span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
401
  </span>
402
  </a>
403
 
@@ -415,8 +415,8 @@ function accordions_tabs_main_items($atts)
415
  ?>
416
 
417
 
418
- <div class="tabs-content tabs-content<?php echo $index; ?> <?php echo $body_class; ?>" id="tabs-<?php echo $index; ?>">
419
- <?php echo $accordion_body; ?>
420
  </div>
421
 
422
  <?php
@@ -432,28 +432,28 @@ function accordions_tabs_main_items($atts)
432
  ?>
433
 
434
  <ul>
435
- <?php echo $nav_html; ?>
436
  </ul>
437
- <?php echo $nav_content_html; ?>
438
  <script>
439
  (function($) {
440
 
441
  $( document ).ready( function() {
442
  <?php
443
  if (isset($_GET['active_index'])) :
444
- $accordion_index = isset($_GET['active_index']) ? esc_attr($_GET['active_index']) : '';
445
  $accordion_index = explode('-', $accordion_index);
446
  foreach ($accordion_index as $args) {
447
  $args_arr = explode('|', $args);
448
  $accordion_id = isset($args_arr[0]) ? $args_arr[0] : '';
449
  $accordion_indexes = isset($args_arr[1]) ? $args_arr[1] : '';
450
  ?>
451
- accordions_tabs_active_index_<?php echo $accordion_id; ?> = <?php echo $accordion_indexes; ?>;
452
  <?php
453
  }
454
  else :
455
  ?>
456
- accordions_tabs_active_index_<?php echo $post_id; ?> = <?php echo json_encode($active_index); ?>;
457
  <?php
458
  endif;
459
  ?>
@@ -485,7 +485,7 @@ function accordions_tabs_main_edit_link($atts)
485
  $accordion_edit_url = apply_filters('accordions_edit_url', '' . $admin_url . 'post.php?post=' . $post_id . '&action=edit');
486
 
487
  ?>
488
- <div class="accordion-edit"><a href="<?php echo $accordion_edit_url; ?>"><?php echo __('Edit this accordion', 'accordions'); ?></a>, <?php echo __("Only admin can see this.", 'accordions') ?></div>
489
  <?php
490
 
491
  }
@@ -510,7 +510,7 @@ function accordions_tabs_main_scripts($atts)
510
  $custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
511
  $custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
512
 
513
- $active_tab = isset($_GET['id']) ? (int)$_GET['id'] : 1;
514
 
515
  $tabs = isset($accordions_options['tabs']) ? $accordions_options['tabs'] : array();
516
  $collapsible = !empty($tabs['collapsible']) ? $tabs['collapsible'] : 'true';
@@ -523,18 +523,18 @@ function accordions_tabs_main_scripts($atts)
523
  <?php
524
  if ($tabs_is_vertical == 'yes') {
525
  ?>
526
- $("#accordions-tabs-<?php echo $post_id; ?>").addClass("ui-tabs-vertical ui-helper-clearfix");
527
- $("#accordions-tabs-<?php echo $post_id; ?> li").removeClass("ui-corner-top").addClass("ui-corner-left");
528
  <?php
529
  }
530
  ?>
531
- $("#accordions-tabs-<?php echo $post_id; ?>").tabs({
532
- collapsible: <?php echo $collapsible; ?>,
533
- event: "<?php echo $active_event; ?>",
534
- active: <?php echo $active_tab; ?>,
535
  });
536
- if (typeof accordions_tabs_active_index_<?php echo $post_id; ?> != 'undefined') {
537
- $("#accordions-tabs-<?php echo $post_id; ?>").tabs("option", "active", accordions_tabs_active_index_<?php echo $post_id; ?>);
538
  }
539
  })})(jQuery);
540
  </script>
@@ -544,7 +544,7 @@ function accordions_tabs_main_scripts($atts)
544
  <script>
545
  (function($) {
546
  $( document ).ready( function() {
547
- <?php echo $custom_js; ?>
548
  })})(jQuery);
549
  </script>
550
  <?php
377
 
378
  ob_start();
379
  ?>
380
+ <li post_id="<?php echo esc_attr($post_id); ?>" header_id="header-<?php echo esc_attr($index); ?>" id="header-<?php echo esc_attr($index); ?>" style="" class="tabs-nav head<?php echo esc_attr($index); ?> <?php echo esc_attr($header_class); ?>" toggle-text="<?php echo do_shortcode(esc_attr($toggled_text)); ?>" main-text="<?php echo do_shortcode(esc_attr($accordion_header)); ?>">
381
 
382
  <?php
383
  if ($icon_position == 'left') :
384
  ?>
385
 
386
+ <a style="" class="accordions-tab-head" href="#tabs-<?php echo esc_attr($index); ?>">
387
+ <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
388
+ <span class="accordion-icon-active accordion-plus"><?php echo esc_html($active_icon); ?></span>
389
+ <span class="accordion-icon-inactive accordion-minus"><?php echo esc_html($inactive_icon); ?></span>
390
  </span>
391
+ <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
392
  </a>
393
  <?php
394
  elseif ($icon_position == 'right') :
395
  ?>
396
+ <a style="" class="accordions-tab-head" href="#tabs-<?php echo esc_attr($index); ?>">
397
+ <span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
398
+ <span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
399
+ <span class="accordion-icon-active accordion-plus"><?php echo esc_html($active_icon); ?></span>
400
+ <span class="accordion-icon-inactive accordion-minus"><?php echo esc_html($inactive_icon); ?></span>
401
  </span>
402
  </a>
403
 
415
  ?>
416
 
417
 
418
+ <div class="tabs-content tabs-content<?php echo esc_attr($index); ?> <?php echo esc_attr($body_class); ?>" id="tabs-<?php echo esc_attr($index); ?>">
419
+ <?php echo esc_html($accordion_body); ?>
420
  </div>
421
 
422
  <?php
432
  ?>
433
 
434
  <ul>
435
+ <?php echo esc_html($nav_html); ?>
436
  </ul>
437
+ <?php echo esc_html($nav_content_html); ?>
438
  <script>
439
  (function($) {
440
 
441
  $( document ).ready( function() {
442
  <?php
443
  if (isset($_GET['active_index'])) :
444
+ $accordion_index = isset($_GET['active_index']) ? absint($_GET['active_index']) : '';
445
  $accordion_index = explode('-', $accordion_index);
446
  foreach ($accordion_index as $args) {
447
  $args_arr = explode('|', $args);
448
  $accordion_id = isset($args_arr[0]) ? $args_arr[0] : '';
449
  $accordion_indexes = isset($args_arr[1]) ? $args_arr[1] : '';
450
  ?>
451
+ accordions_tabs_active_index_<?php echo esc_attr($accordion_id); ?> = <?php echo esc_attr($accordion_indexes); ?>;
452
  <?php
453
  }
454
  else :
455
  ?>
456
+ accordions_tabs_active_index_<?php echo esc_attr($post_id); ?> = <?php echo json_encode($active_index); ?>;
457
  <?php
458
  endif;
459
  ?>
485
  $accordion_edit_url = apply_filters('accordions_edit_url', '' . $admin_url . 'post.php?post=' . $post_id . '&action=edit');
486
 
487
  ?>
488
+ <div class="accordion-edit"><a href="<?php echo esc_url_raw($accordion_edit_url); ?>"><?php echo __('Edit this accordion', 'accordions'); ?></a>, <?php echo __("Only admin can see this.", 'accordions') ?></div>
489
  <?php
490
 
491
  }
510
  $custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
511
  $custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
512
 
513
+ $active_tab = isset($_GET['id']) ? absint($_GET['id']) : 1;
514
 
515
  $tabs = isset($accordions_options['tabs']) ? $accordions_options['tabs'] : array();
516
  $collapsible = !empty($tabs['collapsible']) ? $tabs['collapsible'] : 'true';
523
  <?php
524
  if ($tabs_is_vertical == 'yes') {
525
  ?>
526
+ $("#accordions-tabs-<?php echo esc_attr($post_id); ?>").addClass("ui-tabs-vertical ui-helper-clearfix");
527
+ $("#accordions-tabs-<?php echo esc_attr($post_id); ?> li").removeClass("ui-corner-top").addClass("ui-corner-left");
528
  <?php
529
  }
530
  ?>
531
+ $("#accordions-tabs-<?php echo esc_attr($post_id); ?>").tabs({
532
+ collapsible: <?php echo esc_attr($collapsible); ?>,
533
+ event: "<?php echo esc_attr($active_event); ?>",
534
+ active: <?php echo esc_attr($active_tab); ?>,
535
  });
536
+ if (typeof accordions_tabs_active_index_<?php echo esc_attr($post_id); ?> != 'undefined') {
537
+ $("#accordions-tabs-<?php echo esc_attr($post_id); ?>").tabs("option", "active", accordions_tabs_active_index_<?php echo esc_attr($post_id); ?>);
538
  }
539
  })})(jQuery);
540
  </script>
544
  <script>
545
  (function($) {
546
  $( document ).ready( function() {
547
+ <?php echo esc_js($custom_js); ?>
548
  })})(jQuery);
549
  </script>
550
  <?php