PluginProbe
WP Directory Kit / 1.3.1
WP Directory Kit v1.3.1
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.1, at application/models/Settings_m.php

455 lines 27.5 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_field_search_suggestion_disable',
151 'field_label' => __('Smart Search Suggestion Disable', 'wpdirectorykit'),
152 'field_type' => 'CHECKBOX',
153 'rules' => '',
154 ),
155 );
156
157 /* Fields */
158 $this->fields_list_tabs['fields'] = array(
159 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' => ''),
160 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' => ''),
161
162 array(
163 'field' => 'wdk_multi_locations_search_field_type',
164 'field_label' => __('Location field Search', 'wpdirectorykit'),
165 'field_type' => 'RADIO',
166 'hint' => __('Visible on search form', 'wpdirectorykit'),
167 'rules' => '',
168 'values' => array(
169 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
170 'select2' => esc_html__('Multi Select Dropdown', 'wpdirectorykit'),
171 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
172 'wdk_treefield_checkboxes' => esc_html__('Single Tree Dropdown with checkboxes', 'wpdirectorykit'),
173 )
174 ),
175
176 array(
177 'field' => 'wdk_multi_categories_search_field_type',
178 'field_label' => __('Categoreis field Search', 'wpdirectorykit'),
179 'field_type' => 'RADIO',
180 'hint' => __('Visible on search form. Hiding field in search form based on category is only possible when using single tree dropdown', 'wpdirectorykit'),
181 'rules' => '',
182 'values' => array(
183 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
184 'select2' => esc_html__('Multi Select Dropdown', 'wpdirectorykit'),
185 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
186 'wdk_treefield_checkboxes' => esc_html__('Single Tree Dropdown with checkboxes', 'wpdirectorykit'),
187 )
188 ),
189
190 array(
191 'field' => 'wdk_multi_locations_edit_field_type',
192 'field_label' => __('Location field edit', 'wpdirectorykit'),
193 'field_type' => 'RADIO',
194 'hint' => __('Visible on edit form', 'wpdirectorykit'),
195 'rules' => '',
196 'values' => array(
197 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
198 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
199 )
200 ),
201
202 array(
203 'field' => 'wdk_multi_categories_edit_field_type',
204 'field_label' => __('Categoreis field edit', 'wpdirectorykit'),
205 'field_type' => 'RADIO',
206 'hint' => __('Visible on edit form. Hiding field in edit form based on category is only possible when using single tree dropdown', 'wpdirectorykit'),
207 'rules' => '',
208 'values' => array(
209 '' => esc_html__('Single Tree Dropdown', 'wpdirectorykit'),
210 'wdk_treefield_dropdown' => esc_html__('Multiple Dropdowns', 'wpdirectorykit'),
211 )
212 ),
213
214 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' => ''),
215 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' => ''),
216 array(
217 'field' => 'wdk_listing_plangs_documents_disable',
218 'field_label' => __('Disable "Listing plans and documents"', 'wpdirectorykit'),
219 'hint' => '',
220 'field_type' => 'CHECKBOX',
221 'rules' => '',
222 ),
223 array(
224 'field' => 'wdk_listing_images_disable',
225 'field_label' => __('Disable "Listing images"', 'wpdirectorykit'),
226 'hint' => '',
227 'field_type' => 'CHECKBOX',
228 'rules' => '',
229 ),
230
231
232 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' => ''),
233 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' => ''),
234 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' => ''),
235 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' => ''),
236 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' => ''),
237 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' => ''),
238 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' => ''),
239 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' => ''),
240 array(
241 'field' => 'wdk_sub_listings_enable',
242 'field_label' => __('Related Listings', 'wpdirectorykit'),
243 'field_type' => 'CHECKBOX',
244 'rules' => '',
245 ),
246 array(
247 'field' => 'wdk_listings_images_required_enable',
248 'field_label' => __('Listing Images required', 'wpdirectorykit'),
249 'field_type' => 'CHECKBOX',
250 'rules' => '',
251 ),
252 );
253
254 /* Api-s */
255 $this->fields_list_tabs['apis'] = array(
256 array(
257 'field' => 'wdk_recaptcha_site_key',
258 'field_label' => __('Recaptcha site key', 'wpdirectorykit'),
259 '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>'),
260 'field_type' => 'INPUTBOX',
261 'rules' => '',
262 ),
263 array(
264 'field' => 'wdk_recaptcha_secret_key',
265 'field_label' => __('Recaptcha site secret key', 'wpdirectorykit'),
266 'hint' => __('Add Google Recaptcha secret key', 'wpdirectorykit'),
267 'field_type' => 'INPUTBOX',
268 'rules' => '',
269 ),
270 array(
271 'field' => 'wdk_geo_google_api_key',
272 'field_label' => __('Google API Key', 'wpdirectorykit'),
273 '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>'),
274 'field_type' => 'INPUTBOX',
275 'rules' => '',
276 ),
277 array(
278 'field' => 'wdk_import_google_api_enable',
279 'field_label' => __('Google API for import listings', 'wpdirectorykit'),
280 'hint' => __('Google API key will be used to autodetect GPS coordinates when importing listing', 'wpdirectorykit'),
281 'field_type' => 'CHECKBOX',
282 'rules' => '',
283 ),
284 array(
285 'field' => 'wdk_geo_coding_results_location',
286 'field_label' => __('Auto Search based on Geo Coding', 'wpdirectorykit'),
287 'hint' => __('if this is enabled, auto search listings based on found geo location', 'wpdirectorykit'),
288 'field_type' => 'CHECKBOX',
289 'rules' => '',
290 ),
291 );
292
293 $this->fields_list_tabs['general'] = array(
294 array('field' => 'wdk_default_lat', 'field_label' => __('Default GPS Position', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'MAP', 'rules' => ''),
295 array('field' => 'wdk_default_lng', 'field_label' => __('Default GPS Longitude', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'INPUTBOX', 'rules' => '', 'class' => 'hidden'),
296 array('field' => 'wdk_fixed_map_results_position', 'field_label' => __('Fix map center on default location', 'wpdirectorykit'), 'hint' => '', 'field_type' => 'CHECKBOX', 'rules' => '', 'class' => ''),
297
298
299 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'),
300 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),
301 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),
302 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' => ''),
303
304 array(
305 'field' => 'wdk_card_video_enable',
306 'field_label' => __('Card Video From gallery in result card enable', 'wpdirectorykit'),
307 'hint' => __('If you upload video on first place in listing, will become visible in result card', 'wpdirectorykit'),
308 'field_type' => 'CHECKBOX',
309 'rules' => '',
310 ),
311 array(
312 'field' => 'wdk_listing_category_required',
313 'field_label' => __('Category is required field', 'wpdirectorykit'),
314 'hint' => __('if this is enabled, listing required category field', 'wpdirectorykit'),
315 'field_type' => 'CHECKBOX',
316 'rules' => '',
317 ),
318 array(
319 'field' => 'wdk_listing_location_required',
320 'field_label' => __('Location is required field', 'wpdirectorykit'),
321 'hint' => __('if this is enabled, listing required location field', 'wpdirectorykit'),
322 'field_type' => 'CHECKBOX',
323 'rules' => '',
324 ),
325
326 array(
327 'field' => 'wdk_default_currency_symbol',
328 'field_label' => __('Default Currency Symbol', 'wpdirectorykit'),
329 'hint' => __('Put default currency symbol like $', 'wpdirectorykit'),
330 'field_type' => 'INPUTBOX',
331 'rules' => '',
332 ),
333 array(
334 'field' => 'wdk_experimental_features',
335 'field_label' => __('Experimental features', 'wpdirectorykit'),
336 'hint' => '',
337 'field_type' => 'CHECKBOX',
338 'rules' => '',
339 ),
340 );
341
342 if(function_exists('run_wdk_geo')) {
343 $this->fields_list_tabs['apis'][] = array(
344 'field' => 'wdk_geo_autodetect_by_google_js_enable',
345 'field_label' => __('Enable location autodetect by Google JS', 'wpdirectorykit'),
346 'hint' => __('This using Google JS API, require API key and user need to allow this in Browser (is most accurate)', 'wpdirectorykit'),
347 'field_type' => 'CHECKBOX',
348 'rules' => '',
349 );
350
351 $this->fields_list_tabs['apis'][] = array(
352 'field' => 'wdk_geo_autodetect_by_ip_enable',
353 'field_label' => __('Enable location autodatect by IP', 'wpdirectorykit'),
354 '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'),
355 'field_type' => 'CHECKBOX',
356 'rules' => '',
357 );
358 }
359
360 /* Templates */
361 if(get_option('wdk_experimental_features')) {
362 $this->fields_list_tabs['experimental'] = array(
363 array(
364 'field' => 'wdk_experimental_search_popup',
365 'field_label' => __('Search Popup', 'wpdirectorykit'),
366 'hint' => __('Element open search form in popup', 'wpdirectorykit'),
367 'field_type' => 'CHECKBOX',
368 'rules' => '',
369 ),
370 array(
371 'field' => 'wdk_experimental_listing_card_elementor_layout',
372 'field_label' => __('Listing Card', 'wpdirectorykit'),
373 'hint' => __('Allow Listing card layout in elementor', 'wpdirectorykit'),
374 'field_type' => 'CHECKBOX',
375 'rules' => '',
376 ),
377 array(
378 'field' => 'wdk_experimental_listing_popup',
379 'field_label' => __('Listing Preview Popup', 'wpdirectorykit'),
380 'hint' => __('Open Listing preview in popup', 'wpdirectorykit'),
381 'field_type' => 'CHECKBOX',
382 'rules' => '',
383 ),
384 array(
385 'field' => 'wdk_experimental_ajax_results',
386 'field_label' => __('Ajax results listings', 'wpdirectorykit'),
387 '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'),
388 'field_type' => 'CHECKBOX',
389 'rules' => '',
390 ),
391 );
392 }
393
394 foreach ($this->fields_list_tabs as $tab_fields) {
395 foreach ($tab_fields as $field) {
396 $this->fields_list[] = $field;
397 }
398 }
399 }
400
401 /* [START] For dynamic data table */
402
403 public function get_available_fields()
404 {
405 $fields = $this->db->list_fields($this->_table_name);
406
407 return $fields;
408 }
409
410 public function total_lang($where = array())
411 {
412 $this->db->select('COUNT(*) as total_count');
413 $this->db->from($this->_table_name);
414 $this->db->where($where);
415 $this->db->order_by($this->_order_by);
416 $query = $this->db->get();
417 $res = $this->db->results();
418
419 if(isset($res[0]->total_count))
420 return $res[0]->total_count;
421
422 return 0;
423 }
424
425 public function get_pagination_lang($limit, $offset, $where = array())
426 {
427 $this->db->select('*');
428 $this->db->from($this->_table_name);
429 $this->db->where($where);
430 $this->db->limit($limit);
431 $this->db->offset($offset);
432 $this->db->order_by($this->_order_by);
433 $query = $this->db->get();
434
435 if ($this->db->num_rows() > 0)
436 return $this->db->results();
437
438 return array();
439 }
440
441 public function check_deletable($id)
442 {
443 return true;
444 }
445
446 /* [END] For dynamic data table */
447
448
449 /* only admin can edit */
450 public function is_related($item_id, $user_id, $method = 'edit')
451 {
452 return false;
453 }
454 }
455