PluginProbe
WP Directory Kit / 1.3.3
WP Directory Kit v1.3.3
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / application / models / Settings_m.php

Settings_m.php in WP Directory Kit 1.3.3, at application/models/Settings_m.php

480 lines 28.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // If this file is called directly, abort.
4 if ( ! defined( 'WPINC' ) ) {
5 die;
6 }
7
8 class Settings_m extends Winter_MVC_Model {
9
10 public $_table_name = 'options';
11 public $_order_by = 'option_id';
12 public $_primary_key = 'option_id';
13 public $_own_columns = array();
14 public $_timestamps = TRUE;
15 protected $_primary_filter = 'intval';
16 public $fields_list = array();
17 public $fields_list_tabs = array();
18
19 public function __construct(){
20 parent::__construct();
21
22 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
23 foreach(get_pages(array('sort_column' => 'post_title')) as $page)
24 {
25 $pages[$page->ID] = $page->post_title.' #'.$page->ID;
26 }
27
28 $WMVC = &wdk_get_instance();
29 $WMVC->model('field_m');
30 $fields_data = $WMVC->field_m->get();
31 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
32 $fields_list_inputs = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
33 $order_i = 0;
34
35 $fields_list ['section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
36 $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
37 $fields_list ['post_content'] = esc_html__('WP Content', 'wpdirectorykit');
38
39 foreach($fields_data as $field)
40 {
41 if(wmvc_show_data('field_type', $field) == 'SECTION') {
42 $fields_list ['section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
43 } else {
44 $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
45 }
46
47 if(wmvc_show_data('field_type', $field) == 'INPUTBOX') {
48 $fields_list_inputs [wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
49 }
50 }
51
52 /* General */
53
54 $this->fields_list_tabs['general'] = array(
55 array('field' => 'wdk_default_lat', 'field_label' => __('Default GPS Position', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'MAP', 'rules' => ''),
56 array('field' => 'wdk_default_lng', 'field_label' => __('Default GPS Longitude', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'INPUTBOX', 'rules' => '', 'class' => 'hidden'),
57 array('field' => 'wdk_fixed_map_results_position', 'field_label' => __('Fix map center on default location', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
58
59 array('field' => 'wdk_is_category_enabled', 'field_label' => __('Enable Categories', 'wpdirectorykit'), 'hint' => __('If you don\'t need categories features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
60 array('field' => 'wdk_is_location_enabled', 'field_label' => __('Enable Locations', 'wpdirectorykit'), 'hint' => __('If you don\'t need location features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
61
62
63 array('field' => 'wdk_is_featured_enabled', 'field_label' => __('Enable Field and Feature Featured Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
64 array('field' => 'wdk_is_rank_enabled', 'field_label' => __('Enable Field and Feature Rank Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
65 array('field' => 'wdk_is_user_editor_enabled', 'field_label' => __('Enable Field and Feature Agent Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
66 array('field' => 'wdk_is_post_content_enable', 'field_label' => __('Enable Field and Feature Post Content Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
67 array('field' => 'wdk_is_alt_agent_enabled', 'field_label' => __('Enable Field and Feature Agent Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
68
69 array('field' => 'wdk_slug_listing_preview_page', 'field_label' => __('Custom Listing Preview Page Slug', 'wpdirectorykit'), 'hint' => __('Slug used for listing preview page, if empty, default will be used', 'wpdirectorykit'), 'field_type' => 'INPUTBOX', 'rules' => 'wdk_slug_format'),
70 array('field' => 'wdk_listing_page', 'field_label' => __('Listing Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
71 array('field' => 'wdk_results_page', 'field_label' => __('Results Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for results page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
72 array('field' => 'wdk_is_results_page_require', 'field_label' => __('Always use results page', 'wpdirectorykit'), 'hint' => __('Always even if on current page you have results where can be showed', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
73
74 array(
75 'field' => 'wdk_card_video_enable',
76 'field_label' => __('Card Video From gallery in result card enable', 'wpdirectorykit'),
77 'hint' => __('If you upload video on first place in listing, will become visible in result card', 'wpdirectorykit'),
78 'field_type' => 'CHECKBOX',
79 'rules' => '',
80 ),
81 array(
82 'field' => 'wdk_listing_category_required',
83 'field_label' => __('Category is required field', 'wpdirectorykit'),
84 'hint' => __('if this is enabled, listing required category field', 'wpdirectorykit'),
85 'field_type' => 'CHECKBOX',
86 'rules' => '',
87 ),
88 array(
89 'field' => 'wdk_listing_location_required',
90 'field_label' => __('Location is required field', 'wpdirectorykit'),
91 'hint' => __('if this is enabled, listing required location field', 'wpdirectorykit'),
92 'field_type' => 'CHECKBOX',
93 'rules' => '',
94 ),
95
96 array(
97 'field' => 'wdk_sub_listings_enable',
98 'field_label' => __('Related Listings', 'wpdirectorykit'),
99 'field_type' => 'CHECKBOX',
100 'rules' => '',
101 ),
102 array(
103 'field' => 'wdk_listings_images_required_enable',
104 'field_label' => __('Listing Images required', 'wpdirectorykit'),
105 'field_type' => 'CHECKBOX',
106 'rules' => '',
107 ),
108 array(
109 'field' => 'wdk_default_currency_symbol',
110 'field_label' => __('Default Currency Symbol1', 'wpdirectorykit'),
111 'hint' => __('Put default currency symbol like $', 'wpdirectorykit'),
112 'field_type' => 'INPUTBOX',
113 'rules' => '',
114 ),
115 );
116
117
118 /* Templates */
119 $this->fields_list_tabs['templates'] = array(
120 array(
121 'field' => 'wdk_placeholder',
122 'field_label' => __('Cooming soon listing image', 'wpdirectorykit'),
123 'hint' => '',
124 'field_type' => 'UPLOAD',
125 'rules' => '',
126 ),
127 array(
128 'field' => 'wdk_card_slider_enable',
129 'field_label' => __('Show slider in result card', 'wpdirectorykit'),
130 'hint' => '',
131 'field_type' => 'CHECKBOX',
132 'rules' => '',
133 ),
134 array(
135 'field' => 'wdk_card_video_field',
136 'field_label' => __('Card video field', 'wpdirectorykit'),
137 'hint' => '',
138 'field_type' => 'DROPDOWN',
139 'values' => $fields_list_inputs,
140 'rules' => '',
141 'hint' => '',
142 ),
143 array(
144 'field' => 'wdk_mobile_bottom_navbar_enable',
145 'field_label' => __('Mobile bottom navbar', 'wpdirectorykit'),
146 'field_type' => 'CHECKBOX',
147 'rules' => '',
148 ),
149 array(
150 'field' => 'wdk_mobile_bottom_show_menu_disable',
151 'field_label' => __('Mobile bottom navbar, hide menu button', 'wpdirectorykit'),
152 'hint' => __('Menu button only works, when using menu from ElementInvader addons plugins', 'wpdirectorykit'),
153 'field_type' => 'CHECKBOX',
154 'rules' => '',
155 ),
156 array(
157 'field' => 'wdk_field_search_suggestion_disable',
158 'field_label' => __('Smart Search Suggestion Disable', 'wpdirectorykit'),
159 'field_type' => 'CHECKBOX',
160 'rules' => '',
161 ),
162 );
163
164 /* Fields */
165 $this->fields_list_tabs['fields'] = array(
166 array('field' => 'wdk_seo_keywords', 'field_label' => __('SEO Listing Page Keywords', 'wpdirectorykit'), 'hint' => __('Set field for meta tag keywords', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'values' => $fields_list, 'rules' => ''),
167 array('field' => 'wdk_seo_description', 'field_label' => __('SEO Listing Page Description', 'wpdirectorykit'), 'hint' => __('Set field for meta tag description', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'values' => $fields_list, 'rules' => ''),
168
169 array(
170 'field' => 'wdk_multi_locations_search_field_type',
171 'field_label' => __('Location field Search', 'wpdirectorykit'),
172 'field_type' => 'RADIO',
173 'hint' => __('Visible on search form', 'wpdirectorykit'),
174 'rules' => '',
175 'values' => array(
176 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
177 'select2' => esc_html__('Multi Select Dropdown', 'wpdirectorykit'),
178 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
179 'wdk_treefield_checkboxes' => esc_html__('Single Tree Dropdown with checkboxes', 'wpdirectorykit'),
180 )
181 ),
182
183 array(
184 'field' => 'wdk_multi_categories_search_field_type',
185 'field_label' => __('Categoreis field Search', 'wpdirectorykit'),
186 'field_type' => 'RADIO',
187 'hint' => __('Visible on search form. Hiding field in search form based on category is only possible when using single tree dropdown', 'wpdirectorykit'),
188 'rules' => '',
189 'values' => array(
190 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
191 'select2' => esc_html__('Multi Select Dropdown', 'wpdirectorykit'),
192 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
193 'wdk_treefield_checkboxes' => esc_html__('Single Tree Dropdown with checkboxes', 'wpdirectorykit'),
194 )
195 ),
196
197 array(
198 'field' => 'wdk_multi_locations_edit_field_type',
199 'field_label' => __('Location field edit', 'wpdirectorykit'),
200 'field_type' => 'RADIO',
201 'hint' => __('Visible on edit form', 'wpdirectorykit'),
202 'rules' => '',
203 'values' => array(
204 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
205 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
206 )
207 ),
208
209 array(
210 'field' => 'wdk_multi_categories_edit_field_type',
211 'field_label' => __('Categoreis field edit', 'wpdirectorykit'),
212 'field_type' => 'RADIO',
213 'hint' => __('Visible on edit form. Hiding field in edit form based on category is only possible when using single tree dropdown', 'wpdirectorykit'),
214 'rules' => '',
215 'values' => array(
216 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
217 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
218 )
219 ),
220
221 array('field' => 'wdk_multi_locations_other_enable', 'field_label' => __('Enable multi location on edit listing', 'wpdirectorykit'), 'hint' => __('Enable multi location on edit listing', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
222 array('field' => 'wdk_multi_categories_other_enable', 'field_label' => __('Enable multi categories on edit listing', 'wpdirectorykit'), 'hint' => __('Enable multi categories on edit listing', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
223 array(
224 'field' => 'wdk_listing_plangs_documents_disable',
225 'field_label' => __('Disable "Listing plans and documents"', 'wpdirectorykit'),
226 'hint' => '',
227 'field_type' => 'CHECKBOX',
228 'rules' => '',
229 ),
230 array(
231 'field' => 'wdk_listing_images_disable',
232 'field_label' => __('Disable "Listing images"', 'wpdirectorykit'),
233 'hint' => '',
234 'field_type' => 'CHECKBOX',
235 'rules' => '',
236 ),
237
238
239 array('field' => 'wdk_is_category_enabled', 'field_label' => __('Enable Categories', 'wpdirectorykit'), 'hint' => __('If you don\'t need categories features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
240 array('field' => 'wdk_is_location_enabled', 'field_label' => __('Enable Locations', 'wpdirectorykit'), 'hint' => __('If you don\'t need location features you can disable that here', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
241 array('field' => 'wdk_is_address_enabled', 'field_label' => __('Enable Address', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
242 array('field' => 'wdk_is_featured_enabled', 'field_label' => __('Enable Field and Feature Featured Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
243 array('field' => 'wdk_is_rank_enabled', 'field_label' => __('Enable Field and Feature Rank Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
244 array('field' => 'wdk_is_user_editor_enabled', 'field_label' => __('Enable Field and Feature Agent Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
245 array('field' => 'wdk_is_post_content_enable', 'field_label' => __('Enable Field and Feature Post Content Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
246 array('field' => 'wdk_is_alt_agent_enabled', 'field_label' => __('Enable Field and Feature Agent Listing', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
247 array(
248 'field' => 'wdk_sub_listings_enable',
249 'field_label' => __('Related Listings', 'wpdirectorykit'),
250 'field_type' => 'CHECKBOX',
251 'rules' => '',
252 ),
253 array(
254 'field' => 'wdk_listings_images_required_enable',
255 'field_label' => __('Listing Images required', 'wpdirectorykit'),
256 'field_type' => 'CHECKBOX',
257 'rules' => '',
258 ),
259 array(
260 'field' => 'wdk_number_format_decimal_point',
261 'field_label' => __('Number Format Decimal point', 'wpdirectorykit'),
262 'hint' => __('Default based on location Number Format Decimal point', 'wpdirectorykit'),
263 'field_type' => 'INPUTBOX',
264 'rules' => '',
265 ),
266 array(
267 'field' => 'wdk_number_format_thousands_sep',
268 'field_label' => __('Number Format Thousands sep', 'wpdirectorykit'),
269 'hint' => __('Default based on location Number Thousands sep', 'wpdirectorykit'),
270 'field_type' => 'INPUTBOX',
271 'rules' => '',
272 ),
273 );
274
275 /* Api-s */
276 $this->fields_list_tabs['apis'] = array(
277 array(
278 'field' => 'wdk_recaptcha_site_key',
279 'field_label' => __('Recaptcha site key', 'wpdirectorykit'),
280 'hint' => __('Please add Recaptcha site and Secret keys for enable recaptcha Add Google Recaptcha site key (use V2 recaptcha key)', 'wpdirectorykit').'. '.wdk_sprintf(__('Get key %1$s here %2$s','wpdirectorykit'),'<a target="_blank" href="https://www.google.com/recaptcha/admin">','</a>'),
281 'field_type' => 'INPUTBOX',
282 'rules' => '',
283 ),
284 array(
285 'field' => 'wdk_recaptcha_secret_key',
286 'field_label' => __('Recaptcha site secret key', 'wpdirectorykit'),
287 'hint' => __('Add Google Recaptcha secret key', 'wpdirectorykit'),
288 'field_type' => 'INPUTBOX',
289 'rules' => '',
290 ),
291 array(
292 'field' => 'wdk_geo_google_api_key',
293 'field_label' => __('Google API Key', 'wpdirectorykit'),
294 'hint' => __('Google API Key, for address to gps coordinates conversion', 'wpdirectorykit').'. '.wdk_sprintf(__('Get key %1$s here %2$s','wpdirectorykit'),'<a target="_blank" href="https://developers.google.com/maps/documentation/javascript/get-api-key">','</a>'),
295 'field_type' => 'INPUTBOX',
296 'rules' => '',
297 ),
298 array(
299 'field' => 'wdk_import_google_api_enable',
300 'field_label' => __('Google API for import listings', 'wpdirectorykit'),
301 'hint' => __('Google API key will be used to autodetect GPS coordinates when importing listing', 'wpdirectorykit'),
302 'field_type' => 'CHECKBOX',
303 'rules' => '',
304 ),
305 array(
306 'field' => 'wdk_geo_coding_results_location',
307 'field_label' => __('Auto Search based on Geo Coding', 'wpdirectorykit'),
308 'hint' => __('if this is enabled, auto search listings based on found geo location', 'wpdirectorykit'),
309 'field_type' => 'CHECKBOX',
310 'rules' => '',
311 ),
312 );
313
314 $this->fields_list_tabs['general'] = array(
315 array('field' => 'wdk_default_lat', 'field_label' => __('Default GPS Position', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'MAP', 'rules' => ''),
316 array('field' => 'wdk_default_lng', 'field_label' => __('Default GPS Longitude', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'INPUTBOX', 'rules' => '', 'class' => 'hidden'),
317 array('field' => 'wdk_fixed_map_results_position', 'field_label' => __('Fix map center on default location', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
318
319
320 array('field' => 'wdk_slug_listing_preview_page', 'field_label' => __('Custom Listing Preview Page Slug', 'wpdirectorykit'), 'hint' => __('Slug used for listing preview page, if empty, default will be used', 'wpdirectorykit'), 'field_type' => 'INPUTBOX', 'rules' => 'wdk_slug_format'),
321 array('field' => 'wdk_listing_page', 'field_label' => __('Listing Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for listing preview page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
322 array('field' => 'wdk_results_page', 'field_label' => __('Results Page', 'wpdirectorykit'), 'hint' => __('Select regular page which ill be used for results page on frontend, you can create new one also for this purpose', 'wpdirectorykit'), 'field_type' => 'DROPDOWN', 'rules' => '', 'values' => $pages),
323 array('field' => 'wdk_is_results_page_require', 'field_label' => __('Always use results page', 'wpdirectorykit'), 'hint' => __('Always even if on current page you have results where can be showed', 'wpdirectorykit'), 'field_type' => 'CHECKBOX', 'rules' => ''),
324
325 array(
326 'field' => 'wdk_card_video_enable',
327 'field_label' => __('Card Video From gallery in result card enable', 'wpdirectorykit'),
328 'hint' => __('If you upload video on first place in listing, will become visible in result card', 'wpdirectorykit'),
329 'field_type' => 'CHECKBOX',
330 'rules' => '',
331 ),
332 array(
333 'field' => 'wdk_listing_category_required',
334 'field_label' => __('Category is required field', 'wpdirectorykit'),
335 'hint' => __('if this is enabled, listing required category field', 'wpdirectorykit'),
336 'field_type' => 'CHECKBOX',
337 'rules' => '',
338 ),
339 array(
340 'field' => 'wdk_listing_location_required',
341 'field_label' => __('Location is required field', 'wpdirectorykit'),
342 'hint' => __('if this is enabled, listing required location field', 'wpdirectorykit'),
343 'field_type' => 'CHECKBOX',
344 'rules' => '',
345 ),
346
347 array(
348 'field' => 'wdk_default_currency_symbol',
349 'field_label' => __('Default Currency Symbol', 'wpdirectorykit'),
350 'hint' => __('Put default currency symbol like $', 'wpdirectorykit'),
351 'field_type' => 'INPUTBOX',
352 'rules' => '',
353 ),
354 array(
355 'field' => 'wdk_disable_toolbar_on_content_editor',
356 'field_label' => __('Disable toolbar on content editor', 'wpdirectorykit'),
357 'field_type' => 'CHECKBOX',
358 'rules' => '',
359 ),
360 array(
361 'field' => 'wdk_experimental_features',
362 'field_label' => __('Experimental features', 'wpdirectorykit'),
363 'hint' => '',
364 'field_type' => 'CHECKBOX',
365 'rules' => '',
366 ),
367 );
368
369 if(function_exists('run_wdk_geo')) {
370 $this->fields_list_tabs['apis'][] = array(
371 'field' => 'wdk_geo_autodetect_by_google_js_enable',
372 'field_label' => __('Enable location autodetect by Google JS', 'wpdirectorykit'),
373 'hint' => __('This using Google JS API, require API key and user need to allow this in Browser (is most accurate)', 'wpdirectorykit'),
374 'field_type' => 'CHECKBOX',
375 'rules' => '',
376 );
377
378 $this->fields_list_tabs['apis'][] = array(
379 'field' => 'wdk_geo_autodetect_by_ip_enable',
380 'field_label' => __('Enable location autodatect by IP', 'wpdirectorykit'),
381 'hint' => __('This using Free API www.geoplugin.net, not require API key and is not so accurate as Google version, if both enabled then this will be used if Google failed', 'wpdirectorykit'),
382 'field_type' => 'CHECKBOX',
383 'rules' => '',
384 );
385 }
386
387 /* Templates */
388 $this->fields_list_tabs['experimental'] = array(
389 array(
390 'field' => 'wdk_experimental_search_popup',
391 'field_label' => __('Search Popup', 'wpdirectorykit'),
392 'hint' => __('Element open search form in popup', 'wpdirectorykit'),
393 'field_type' => 'CHECKBOX',
394 'rules' => '',
395 ),
396 array(
397 'field' => 'wdk_experimental_listing_card_elementor_layout',
398 'field_label' => __('Listing Card', 'wpdirectorykit'),
399 'hint' => __('Allow Listing card layout in elementor', 'wpdirectorykit'),
400 'field_type' => 'CHECKBOX',
401 'rules' => '',
402 ),
403 array(
404 'field' => 'wdk_experimental_listing_popup',
405 'field_label' => __('Listing Preview Popup', 'wpdirectorykit'),
406 'hint' => __('Open Listing preview in popup', 'wpdirectorykit'),
407 'field_type' => 'CHECKBOX',
408 'rules' => '',
409 ),
410 array(
411 'field' => 'wdk_experimental_ajax_results',
412 'field_label' => __('Ajax results listings', 'wpdirectorykit'),
413 'hint' => __('Allow ajax load listings for map, results container. Reload results with pagination/search form. After activate settings, also action "Reload content with ajax" in elementor options', 'wpdirectorykit'),
414 'field_type' => 'CHECKBOX',
415 'rules' => '',
416 ),
417 );
418
419 foreach ($this->fields_list_tabs as $tab_fields) {
420 foreach ($tab_fields as $field) {
421 $this->fields_list[] = $field;
422 }
423 }
424 }
425
426 /* [START] For dynamic data table */
427
428 public function get_available_fields()
429 {
430 $fields = $this->db->list_fields($this->_table_name);
431
432 return $fields;
433 }
434
435 public function total_lang($where = array())
436 {
437 $this->db->select('COUNT(*) as total_count');
438 $this->db->from($this->_table_name);
439 $this->db->where($where);
440 $this->db->order_by($this->_order_by);
441 $query = $this->db->get();
442 $res = $this->db->results();
443
444 if(isset($res[0]->total_count))
445 return $res[0]->total_count;
446
447 return 0;
448 }
449
450 public function get_pagination_lang($limit, $offset, $where = array())
451 {
452 $this->db->select('*');
453 $this->db->from($this->_table_name);
454 $this->db->where($where);
455 $this->db->limit($limit);
456 $this->db->offset($offset);
457 $this->db->order_by($this->_order_by);
458 $query = $this->db->get();
459
460 if ($this->db->num_rows() > 0)
461 return $this->db->results();
462
463 return array();
464 }
465
466 public function check_deletable($id)
467 {
468 return true;
469 }
470
471 /* [END] For dynamic data table */
472
473
474 /* only admin can edit */
475 public function is_related($item_id, $user_id, $method = 'edit')
476 {
477 return false;
478 }
479 }
480