| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly; |
| 3 |
|
| 4 |
class Wdk_frontendajax extends Winter_MVC_Controller { |
| 5 |
|
| 6 |
public function __construct(){ |
| 7 |
if(defined( 'WP_DEBUG' ) && WP_DEBUG) { |
| 8 |
ini_set('display_errors',1); |
| 9 |
ini_set('display_startup_errors',1); |
| 10 |
error_reporting(-1); |
| 11 |
} |
| 12 |
|
| 13 |
parent::__construct(); |
| 14 |
|
| 15 |
$this->data['is_ajax'] = true; |
| 16 |
|
| 17 |
} |
| 18 |
|
| 19 |
public function index(&$output=NULL, $atts=array()) |
| 20 |
{ |
| 21 |
|
| 22 |
} |
| 23 |
|
| 24 |
public function map_infowindow() { |
| 25 |
$this->load->load_helper('listing'); |
| 26 |
$this->load->model('listing_m'); |
| 27 |
$this->load->model('listingfield_m'); |
| 28 |
|
| 29 |
$data = array(); |
| 30 |
$data['message'] = ''; |
| 31 |
$listing_post_id = NULL; |
| 32 |
if(isset($_POST['listing_post_id'])) |
| 33 |
$listing_post_id = sanitize_text_field($_POST['listing_post_id']); |
| 34 |
|
| 35 |
$listing = $this->load->listing_m->get($listing_post_id, TRUE); |
| 36 |
|
| 37 |
if(!empty($listing)) { |
| 38 |
$data['popup_content'] = wdk_listing_card($listing, array('infobox' => true), false, '<div class="infobox map-box">%1$s<div>'); |
| 39 |
} else { |
| 40 |
$data['popup_content'] = __( 'Listing is missing', 'wpdirectorykit' ); |
| 41 |
} |
| 42 |
|
| 43 |
$data['success'] = true; |
| 44 |
|
| 45 |
$this->output($data); |
| 46 |
} |
| 47 |
|
| 48 |
public function map_infowindow_dash() { |
| 49 |
$this->load->load_helper('listing'); |
| 50 |
$this->load->model('listing_m'); |
| 51 |
$this->load->model('listingfield_m'); |
| 52 |
|
| 53 |
$data = array(); |
| 54 |
$data['message'] = ''; |
| 55 |
$listing_post_id = NULL; |
| 56 |
if(isset($_POST['listing_post_id'])) |
| 57 |
$listing_post_id = sanitize_text_field($_POST['listing_post_id']); |
| 58 |
|
| 59 |
$listing = $this->load->listing_m->get($listing_post_id, TRUE); |
| 60 |
|
| 61 |
if(!empty($listing)) { |
| 62 |
$data['popup_content'] = wdk_listing_card($listing, [], false, '<div class="infobox map-box">%1$s<div>', 'result_item_card_dash_edit'); |
| 63 |
} else { |
| 64 |
$data['popup_content'] = __( 'Listing is missing', 'wpdirectorykit' ); |
| 65 |
} |
| 66 |
|
| 67 |
$data['success'] = true; |
| 68 |
|
| 69 |
$this->output($data); |
| 70 |
} |
| 71 |
|
| 72 |
public function treefieldid($output="", $atts=array(), $instance=NULL) |
| 73 |
{ |
| 74 |
$this->load->load_helper('listing'); |
| 75 |
$this->load->model('listing_m'); |
| 76 |
$this->load->model('listingfield_m'); |
| 77 |
|
| 78 |
$data = array(); |
| 79 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 80 |
$results = array(); |
| 81 |
|
| 82 |
$parameters = array(); |
| 83 |
|
| 84 |
foreach ($_POST as $key => $value) { |
| 85 |
$parameters[$key] = sanitize_text_field($value); |
| 86 |
} |
| 87 |
|
| 88 |
$table_name = $table = $parameters['table']; |
| 89 |
|
| 90 |
if(empty($parameters['empty_value'])) |
| 91 |
$parameters['empty_value'] = ' - '; |
| 92 |
|
| 93 |
if(empty($parameters['limit'])) |
| 94 |
$parameters['limit'] = 10; |
| 95 |
|
| 96 |
if(empty($parameters['attribute_id'])) |
| 97 |
$parameters['attribute_id'] = 'id'; |
| 98 |
|
| 99 |
if(empty($parameters['attribute_value'])) |
| 100 |
$parameters['attribute_value'] = 'address'; |
| 101 |
|
| 102 |
if(empty($parameters['offset'])) |
| 103 |
$parameters['offset'] = 0; |
| 104 |
|
| 105 |
$start_id = ''; |
| 106 |
if(isset($parameters['start_id'])) |
| 107 |
$start_id = $parameters['start_id']; |
| 108 |
|
| 109 |
if($parameters['offset'] == 0) // currently don't have load_more functionality' |
| 110 |
|
| 111 |
if(!empty($parameters['empty_value'])) |
| 112 |
{ |
| 113 |
$results[0]['key'] = ''; |
| 114 |
$results[0]['value'] = sanitize_text_field($parameters['empty_value']); |
| 115 |
} |
| 116 |
|
| 117 |
// it's model |
| 118 |
|
| 119 |
if($table == 'calendar_listing_m') |
| 120 |
$table = 'listing_m'; |
| 121 |
|
| 122 |
$table_name = substr($table,0, -2); |
| 123 |
$attr_id = sanitize_text_field($parameters['attribute_id']); |
| 124 |
$attr_val = sanitize_text_field($parameters['attribute_value']); |
| 125 |
$attr_search = sanitize_text_field($parameters['search_term']); |
| 126 |
$skip_id = intval($parameters['skip_id']); |
| 127 |
$language_id = intval($parameters['language_id']); |
| 128 |
|
| 129 |
if(empty($language_id)) |
| 130 |
$language_id = NULL; |
| 131 |
|
| 132 |
$id_part=""; |
| 133 |
if(is_numeric($attr_search)) |
| 134 |
$id_part = "$attr_id=$attr_search OR "; |
| 135 |
|
| 136 |
if($table == 'icons_list') { |
| 137 |
$icons = $this->get_fa_icons(); |
| 138 |
|
| 139 |
$tree_results = array(); |
| 140 |
|
| 141 |
if(empty($attr_search)) { |
| 142 |
$tree_results = $icons; |
| 143 |
} else { |
| 144 |
foreach ($icons as $c){ |
| 145 |
if (stripos($c, $attr_search) !== FALSE){ |
| 146 |
//if $c starts with $input, add to matches list |
| 147 |
$tree_results[] = $c; |
| 148 |
} else if (strcmp($attr_search, $c) < 0){ |
| 149 |
//$input comes after $c in alpha order |
| 150 |
//since $colors is sorted, we know that we won't find any more matches |
| 151 |
continue; |
| 152 |
} |
| 153 |
} |
| 154 |
} |
| 155 |
$tree_results = array_slice($tree_results,intval($parameters['offset']), intval($parameters['limit'])); |
| 156 |
// limit |
| 157 |
|
| 158 |
} else { |
| 159 |
$this->load->model($table); |
| 160 |
|
| 161 |
$where = array(); |
| 162 |
if(!empty($attr_search)) |
| 163 |
$where["($id_part $attr_val LIKE '%$attr_search%')"] = NULL; |
| 164 |
|
| 165 |
if(!empty($parameters['attr_search'])) |
| 166 |
$where[$parameters['attr_search']] = NULL; |
| 167 |
|
| 168 |
if(isset($parameters['user_check']) && ($parameters['user_check'] == 'true' || $parameters['user_check'] == '1')) { |
| 169 |
if($table == 'listing_m') { |
| 170 |
if($parameters['table'] == 'calendar_listing_m') { |
| 171 |
global $Winter_MVC_wdk_bookings; |
| 172 |
$Winter_MVC_wdk_bookings->model('calendar_m'); |
| 173 |
$this->db->join($Winter_MVC_wdk_bookings->calendar_m->_table_name.' ON '.$this->$table->_table_name.'.post_id = '.$Winter_MVC_wdk_bookings->calendar_m->_table_name.'.post_id'); |
| 174 |
} |
| 175 |
|
| 176 |
$tree_results = $this->$table->get_pagination(intval($parameters['limit']),intval($parameters['offset']), $where, TRUE, get_current_user_id()); |
| 177 |
} else { |
| 178 |
|
| 179 |
if(!empty($parameters['filter_ids'])){ |
| 180 |
$this->db->where(array( esc_sql($this->$table->_primary_key).' IN ('.esc_sql($parameters['filter_ids']).')' => NULL)); |
| 181 |
} |
| 182 |
|
| 183 |
$tree_results = $this->$table->get_pagination(intval($parameters['limit']),intval($parameters['offset']), $where ); |
| 184 |
} |
| 185 |
} else { |
| 186 |
if($parameters['table'] == 'calendar_listing_m') { |
| 187 |
global $Winter_MVC_wdk_bookings; |
| 188 |
$Winter_MVC_wdk_bookings->model('calendar_m'); |
| 189 |
$this->db->join($Winter_MVC_wdk_bookings->calendar_m->_table_name.' ON '.$this->$table->_table_name.'.post_id = '.$Winter_MVC_wdk_bookings->calendar_m->_table_name.'.post_id'); |
| 190 |
} |
| 191 |
|
| 192 |
if(!empty($parameters['filter_ids'])){ |
| 193 |
$this->db->where(array( esc_sql($this->$table->_primary_key).' IN ('.esc_sql($parameters['filter_ids']).')' => NULL)); |
| 194 |
} |
| 195 |
|
| 196 |
if($table == 'user_m') { |
| 197 |
$like = "(meta_value LIKE '%wdk_%' )"; |
| 198 |
$tree_results = $this->$table->get_pagination(intval($parameters['limit']),intval($parameters['offset']), $where, NULL, $like); |
| 199 |
|
| 200 |
} else { |
| 201 |
$tree_results = $this->$table->get_pagination(intval($parameters['limit']),intval($parameters['offset']), $where); |
| 202 |
} |
| 203 |
|
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
$ind_order=1; |
| 208 |
foreach ($tree_results as $key=>$row) |
| 209 |
{ |
| 210 |
$level_gen=''; |
| 211 |
if(empty($attr_search) && isset($row->level)) |
| 212 |
$level_gen = str_pad('', $row->level*12, ' ').''; |
| 213 |
|
| 214 |
$results[$ind_order]['key'] = wmvc_show_data($attr_id, $row); |
| 215 |
if($table == 'listing_m') { |
| 216 |
$results[$ind_order]['value'] = $level_gen |
| 217 |
.'#'.wmvc_show_data($attr_id, $row).', '.wmvc_show_data($attr_val, $row); |
| 218 |
} elseif($table == 'user_m') { |
| 219 |
$results[$ind_order]['value'] = $level_gen |
| 220 |
.'#'.wmvc_show_data($attr_id, $row).', '.wmvc_show_data($attr_val, $row).' ('.wmvc_show_data('user_email', $row).')'; |
| 221 |
} elseif($table == 'icons_list') { |
| 222 |
$results[$ind_order]['key'] = $row; |
| 223 |
if(defined('ELEMENTOR_ASSETS_URL')){ |
| 224 |
$results[$ind_order]['value'] = '<i class="'. $row.'"></i> '.$row; |
| 225 |
} else { |
| 226 |
$results[$ind_order]['value'] = $row; |
| 227 |
} |
| 228 |
} else { |
| 229 |
$results[$ind_order]['value'] = $level_gen |
| 230 |
.esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit'); |
| 231 |
} |
| 232 |
$ind_order++; |
| 233 |
} |
| 234 |
|
| 235 |
|
| 236 |
// get current value by ID |
| 237 |
$row=NULL; |
| 238 |
if($table == 'icons_list') { |
| 239 |
if(!empty($parameters['curr_id'])) { |
| 240 |
$row = '<i class="'. $parameters['curr_id'].'"></i> '.$parameters['curr_id']; |
| 241 |
} |
| 242 |
} else { |
| 243 |
if(!empty($parameters['curr_id'])) |
| 244 |
$row = $this->$table->get(intval($parameters['curr_id']), TRUE); |
| 245 |
} |
| 246 |
|
| 247 |
if($table == 'icons_list') { |
| 248 |
$data['curr_val'] = $row; |
| 249 |
}elseif(is_object($row)) |
| 250 |
{ |
| 251 |
$level_gen=''; |
| 252 |
if(isset($row->level)) |
| 253 |
$level_gen = str_pad('', $row->level*12, ' ').''; |
| 254 |
|
| 255 |
if($table == 'user_m') { |
| 256 |
$data['curr_val'] = $level_gen |
| 257 |
.wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row).' ('.wmvc_show_data('user_email', $row).')'.' #'.wmvc_show_data($attr_id, $row); |
| 258 |
} else { |
| 259 |
$data['curr_val'] = $level_gen |
| 260 |
.esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit'); |
| 261 |
} |
| 262 |
|
| 263 |
|
| 264 |
//if(!empty($start_id) && $start_id == $parameters['curr_id'] && isset($parameters['sub_empty_value']) && !empty($parameters['sub_empty_value'])) $this->data['curr_val'] = wmvc_show_data('sub_empty_value', $parameters); |
| 265 |
//elseif(!empty($start_id) && $start_id == $parameters['curr_id']) $this->data['curr_val'] = $parameters['empty_value']; |
| 266 |
} |
| 267 |
else |
| 268 |
{ |
| 269 |
$data['curr_val'] = $parameters['empty_value']; |
| 270 |
} |
| 271 |
|
| 272 |
$this->data['success'] = true; |
| 273 |
|
| 274 |
$data['results'] = $results; |
| 275 |
//$data['sql'] = $this->db->last_query(); |
| 276 |
$this->output($data); |
| 277 |
} |
| 278 |
|
| 279 |
public function treefieldid_checkboxes($output="", $atts=array(), $instance=NULL) |
| 280 |
{ |
| 281 |
$this->load->load_helper('listing'); |
| 282 |
$this->load->model('listing_m'); |
| 283 |
$this->load->model('listingfield_m'); |
| 284 |
|
| 285 |
$data = array(); |
| 286 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 287 |
$results = array(); |
| 288 |
|
| 289 |
$parameters = array(); |
| 290 |
|
| 291 |
foreach ($_POST as $key => $value) { |
| 292 |
$parameters[$key] = sanitize_text_field($value); |
| 293 |
} |
| 294 |
|
| 295 |
$table_name = $table = $parameters['table']; |
| 296 |
|
| 297 |
if(empty($parameters['empty_value'])) |
| 298 |
$parameters['empty_value'] = ' - '; |
| 299 |
|
| 300 |
if(empty($parameters['limit'])) |
| 301 |
$parameters['limit'] = 10; |
| 302 |
|
| 303 |
if(empty($parameters['attribute_id'])) |
| 304 |
$parameters['attribute_id'] = 'id'; |
| 305 |
|
| 306 |
if(empty($parameters['attribute_value'])) |
| 307 |
$parameters['attribute_value'] = 'address'; |
| 308 |
|
| 309 |
if(empty($parameters['offset'])) |
| 310 |
$parameters['offset'] = 0; |
| 311 |
|
| 312 |
$start_id = ''; |
| 313 |
if(isset($parameters['start_id'])) |
| 314 |
$start_id = $parameters['start_id']; |
| 315 |
|
| 316 |
if($parameters['offset'] == 0) // currently don't have load_more functionality' |
| 317 |
|
| 318 |
if(!empty($parameters['empty_value'])) |
| 319 |
{ |
| 320 |
$results[0]['key'] = ''; |
| 321 |
$results[0]['value'] = sanitize_text_field($parameters['empty_value']); |
| 322 |
} |
| 323 |
|
| 324 |
// it's model |
| 325 |
|
| 326 |
if($table == 'calendar_listing_m') |
| 327 |
$table = 'listing_m'; |
| 328 |
|
| 329 |
$table_name = substr($table,0, -2); |
| 330 |
$attr_id = sanitize_text_field($parameters['attribute_id']); |
| 331 |
$attr_val = sanitize_text_field($parameters['attribute_value']); |
| 332 |
$attr_search = sanitize_text_field($parameters['search_term']); |
| 333 |
$skip_id = intval($parameters['skip_id']); |
| 334 |
$language_id = intval($parameters['language_id']); |
| 335 |
|
| 336 |
if(empty($language_id)) |
| 337 |
$language_id = NULL; |
| 338 |
|
| 339 |
$id_part=""; |
| 340 |
if(is_numeric($attr_search)) |
| 341 |
$id_part = "$attr_id=$attr_search OR "; |
| 342 |
|
| 343 |
$this->load->model($table); |
| 344 |
|
| 345 |
$where = array(); |
| 346 |
if(!empty($attr_search)) |
| 347 |
$where["($id_part $attr_val LIKE '%$attr_search%')"] = NULL; |
| 348 |
|
| 349 |
if(isset($parameters['selected']) && !empty($parameters['selected'])) { |
| 350 |
|
| 351 |
if(is_string($parameters['selected']) && strpos($parameters['selected'], ',') !== FALSE){ |
| 352 |
$selected = explode(',', $parameters['selected']); |
| 353 |
} elseif(is_string($parameters['selected'])){ |
| 354 |
$selected = array($parameters['selected']); |
| 355 |
} |
| 356 |
|
| 357 |
$ids = array(); |
| 358 |
foreach($selected as $selected_item) { |
| 359 |
if(!empty($selected_item) && is_intval($selected_item)) { |
| 360 |
$ids [] = $selected_item; |
| 361 |
} |
| 362 |
} |
| 363 |
|
| 364 |
/* where in */ |
| 365 |
if(!empty($ids)){ |
| 366 |
$this->db->order_by('FIELD('.$this->$table->_table_name.'.'.$this->$table->_primary_key.', '. implode(',', array_reverse($ids)) . ') DESC'); |
| 367 |
if(intval($parameters['limit']) < count($ids)) { |
| 368 |
$parameters['limit'] = count($ids); |
| 369 |
} |
| 370 |
} |
| 371 |
} |
| 372 |
|
| 373 |
if(!empty($parameters['filter_ids'])){ |
| 374 |
$this->db->where(array( esc_sql($this->$table->_primary_key).' IN ('.esc_sql($parameters['filter_ids']).')' => NULL)); |
| 375 |
} |
| 376 |
|
| 377 |
$tree_results = $this->$table->get_pagination(intval($parameters['limit']),intval($parameters['offset']), $where); |
| 378 |
|
| 379 |
$ind_order=1; |
| 380 |
foreach ($tree_results as $key=>$row) |
| 381 |
{ |
| 382 |
$level_gen=''; |
| 383 |
if(empty($attr_search) && isset($row->level)) |
| 384 |
$level_gen = str_pad('', $row->level*12, ' ').''; |
| 385 |
|
| 386 |
$results[$ind_order]['key'] = wmvc_show_data($attr_id, $row); |
| 387 |
$results[$ind_order]['value'] = $level_gen |
| 388 |
.esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit'); |
| 389 |
$ind_order++; |
| 390 |
} |
| 391 |
|
| 392 |
// get current value by ID |
| 393 |
$row=NULL; |
| 394 |
if(!empty($parameters['curr_id'])) |
| 395 |
$row = $this->$table->get(intval($parameters['curr_id']), TRUE); |
| 396 |
|
| 397 |
if(is_object($row)) |
| 398 |
{ |
| 399 |
$level_gen=''; |
| 400 |
if(isset($row->level)) |
| 401 |
$level_gen = str_pad('', $row->level*12, ' ').''; |
| 402 |
|
| 403 |
$data['curr_val'] = $level_gen |
| 404 |
.esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit'); |
| 405 |
|
| 406 |
} |
| 407 |
else |
| 408 |
{ |
| 409 |
$data['curr_val'] = $parameters['empty_value']; |
| 410 |
} |
| 411 |
|
| 412 |
$this->data['success'] = true; |
| 413 |
|
| 414 |
$data['results'] = $results; |
| 415 |
//$data['sql'] = $this->db->last_query(); |
| 416 |
$this->output($data); |
| 417 |
} |
| 418 |
|
| 419 |
private function output($data, $print = TRUE) { |
| 420 |
if($print) { |
| 421 |
header('Pragma: no-cache'); |
| 422 |
header('Cache-Control: no-store, no-cache'); |
| 423 |
header('Content-Type: application/json; charset=utf8'); |
| 424 |
//header('Content-Length: '.$length); // special characters causing troubles |
| 425 |
echo (wp_json_encode($data)); |
| 426 |
exit(); |
| 427 |
} else { |
| 428 |
return $data; |
| 429 |
} |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
public function select_2_ajax($output="", $atts=array(), $instance=NULL) |
| 434 |
{ |
| 435 |
$this->load->load_helper('listing'); |
| 436 |
$this->load->model('listing_m'); |
| 437 |
$this->load->model('listingfield_m'); |
| 438 |
|
| 439 |
$data = array(); |
| 440 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 441 |
$results = array(); |
| 442 |
$data['pagination'] = true; |
| 443 |
$parameters = array(); |
| 444 |
|
| 445 |
foreach ($_POST as $key => $value) { |
| 446 |
$parameters[$key] = sanitize_text_field($value); |
| 447 |
} |
| 448 |
|
| 449 |
if(empty($parameters['table'])) return false; |
| 450 |
|
| 451 |
$model_name = $parameters['table']; |
| 452 |
|
| 453 |
$key_column = ''; |
| 454 |
$print_column = ''; |
| 455 |
|
| 456 |
$search_column = ''; |
| 457 |
if(empty($parameters['columns_search'])) { |
| 458 |
switch ($model_name) { |
| 459 |
case 'category_m': |
| 460 |
$search_column = 'idcategory,category_title'; |
| 461 |
break; |
| 462 |
case 'location_m': |
| 463 |
$search_column = 'idlocation,location_title'; |
| 464 |
break; |
| 465 |
|
| 466 |
default: |
| 467 |
# code... |
| 468 |
break; |
| 469 |
} |
| 470 |
} else { |
| 471 |
$search_column = $parameters['columns_search']; |
| 472 |
} |
| 473 |
|
| 474 |
if(empty($parameters['key_column'])) { |
| 475 |
switch ($model_name) { |
| 476 |
case 'category_m': |
| 477 |
$key_column = 'idcategory'; |
| 478 |
break; |
| 479 |
case 'location_m': |
| 480 |
$key_column = 'idlocation'; |
| 481 |
break; |
| 482 |
|
| 483 |
default: |
| 484 |
# code... |
| 485 |
break; |
| 486 |
} |
| 487 |
} else { |
| 488 |
$key_column = $parameters['key_column']; |
| 489 |
} |
| 490 |
|
| 491 |
if(empty($parameters['print_column'])) { |
| 492 |
switch ($model_name) { |
| 493 |
case 'category_m': |
| 494 |
$print_column = 'category_title'; |
| 495 |
break; |
| 496 |
case 'location_m': |
| 497 |
$print_column = 'location_title'; |
| 498 |
break; |
| 499 |
|
| 500 |
default: |
| 501 |
# code... |
| 502 |
break; |
| 503 |
} |
| 504 |
} else { |
| 505 |
$print_column = $parameters['print_column']; |
| 506 |
} |
| 507 |
|
| 508 |
$limit = 20; |
| 509 |
if(!empty($parameters['limit'])) { |
| 510 |
$limit = intval($parameters['limit']); |
| 511 |
} |
| 512 |
|
| 513 |
$offset = NULL; |
| 514 |
if(!empty($parameters['page_result']) && $parameters['page_result'] > 1) { |
| 515 |
$offset = (intval($parameters['page_result']) - 1) * $limit; |
| 516 |
} |
| 517 |
|
| 518 |
$this->load->model($model_name); |
| 519 |
|
| 520 |
$where = array(); |
| 521 |
if(!empty($_POST['q']['term']) && !empty($search_column)) { |
| 522 |
$sql_search = ''; |
| 523 |
foreach (explode(',', $search_column) as $column) { |
| 524 |
if(empty($column)) continue; |
| 525 |
|
| 526 |
if(!empty($sql_search)) |
| 527 |
$sql_search .= " OR "; |
| 528 |
|
| 529 |
$sql_search .= " ".esc_sql($column)." LIKE '%".esc_sql($_POST['q']['term'])."%'"; |
| 530 |
} |
| 531 |
|
| 532 |
$where ["($sql_search)"] = NULL; |
| 533 |
} |
| 534 |
|
| 535 |
$db_results_total = $this->$model_name->total($where); |
| 536 |
$db_results = $this->$model_name->get_pagination($limit,$offset, $where); |
| 537 |
$data['output'] = $db_results; |
| 538 |
|
| 539 |
if (!$db_results) { |
| 540 |
$data['errors'] = ''; |
| 541 |
} else { |
| 542 |
foreach($db_results as $row) { |
| 543 |
|
| 544 |
$level_gen=''; |
| 545 |
if(empty($attr_search) && isset($row->level)) |
| 546 |
$level_gen = str_pad('', $row->level*12, ' ').''; |
| 547 |
|
| 548 |
$results[] = [ |
| 549 |
'id'=> wmvc_show_data($key_column, $row), |
| 550 |
'text'=> $level_gen.esc_html__(trim(wmvc_show_data($print_column, $row)), 'wpdirectorykit'), |
| 551 |
]; |
| 552 |
} |
| 553 |
|
| 554 |
} |
| 555 |
|
| 556 |
$data['success'] = true; |
| 557 |
|
| 558 |
$data['results'] = $results; |
| 559 |
|
| 560 |
|
| 561 |
if($db_results_total >= $limit + $offset) { |
| 562 |
$data['pagination'] =[ |
| 563 |
"more"=> true |
| 564 |
]; |
| 565 |
} |
| 566 |
|
| 567 |
//$data['sql'] = $this->db->last_query(); |
| 568 |
$this->output($data); |
| 569 |
} |
| 570 |
|
| 571 |
public function select_2_ajax_user($output="", $atts=array(), $instance=NULL) |
| 572 |
{ |
| 573 |
$this->load->load_helper('listing'); |
| 574 |
|
| 575 |
$data = array(); |
| 576 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 577 |
$results = array(); |
| 578 |
$data['pagination'] = true; |
| 579 |
$parameters = array(); |
| 580 |
|
| 581 |
foreach ($_POST as $key => $value) { |
| 582 |
$parameters[$key] = sanitize_text_field($value); |
| 583 |
} |
| 584 |
|
| 585 |
$model_name = 'user_m'; |
| 586 |
|
| 587 |
$key_column = ''; |
| 588 |
$print_column = ''; |
| 589 |
|
| 590 |
$limit = 20; |
| 591 |
if(!empty($parameters['limit'])) { |
| 592 |
$limit = intval($parameters['limit']); |
| 593 |
} |
| 594 |
|
| 595 |
$offset = NULL; |
| 596 |
if(!empty($parameters['page_result']) && $parameters['page_result'] > 1) { |
| 597 |
$offset = (intval($parameters['page_result']) - 1) * $limit; |
| 598 |
} |
| 599 |
|
| 600 |
$this->load->model($model_name); |
| 601 |
$search_column = 'display_name,user_email,user_login,ID'; |
| 602 |
$where = array(); |
| 603 |
if(!empty($_POST['q']['term']) && !empty($search_column)) { |
| 604 |
$sql_search = ''; |
| 605 |
foreach (explode(',', $search_column) as $column) { |
| 606 |
if(empty($column)) continue; |
| 607 |
|
| 608 |
if(!empty($sql_search)) |
| 609 |
$sql_search .= " OR "; |
| 610 |
|
| 611 |
$sql_search .= " ".esc_sql($column)." LIKE '%".esc_sql($_POST['q']['term'])."%'"; |
| 612 |
} |
| 613 |
|
| 614 |
$where ["($sql_search)"] = NULL; |
| 615 |
} |
| 616 |
|
| 617 |
$like = "(meta_value LIKE '%wdk_%' )"; |
| 618 |
$db_results_total = $this->$model_name->total($where, NULL, $like); |
| 619 |
|
| 620 |
$db_results = $this->$model_name->get_pagination($limit,$offset, $where, NULL, $like); |
| 621 |
$data['output'] = $db_results; |
| 622 |
|
| 623 |
if (!$db_results) { |
| 624 |
$data['errors'] = ''; |
| 625 |
} else { |
| 626 |
foreach($db_results as $row) { |
| 627 |
|
| 628 |
$level_gen=''; |
| 629 |
//if(empty($attr_search) && isset($row->level)) |
| 630 |
// $level_gen = str_pad('', $row->level*12, ' ').''; |
| 631 |
|
| 632 |
$results[] = [ |
| 633 |
'id'=> wmvc_show_data('ID', $row), |
| 634 |
'text'=> $level_gen.trim(wmvc_show_data('display_name', $row)), |
| 635 |
]; |
| 636 |
} |
| 637 |
|
| 638 |
} |
| 639 |
|
| 640 |
$data['success'] = true; |
| 641 |
|
| 642 |
$data['results'] = $results; |
| 643 |
if($db_results_total >= $limit + $offset) { |
| 644 |
$data['pagination'] =[ |
| 645 |
"more"=> true |
| 646 |
]; |
| 647 |
} |
| 648 |
|
| 649 |
//$data['sql'] = $this->db->last_query(); |
| 650 |
$this->output($data); |
| 651 |
} |
| 652 |
|
| 653 |
|
| 654 |
public function wdk_tree_dropdowns($output="", $atts=array(), $instance=NULL) |
| 655 |
{ |
| 656 |
$this->load->load_helper('listing'); |
| 657 |
|
| 658 |
$data = array(); |
| 659 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 660 |
$results = array(); |
| 661 |
$parameters = array(); |
| 662 |
|
| 663 |
foreach ($_POST as $key => $value) { |
| 664 |
$parameters[$key] = sanitize_text_field($value); |
| 665 |
} |
| 666 |
|
| 667 |
if(empty($parameters['table'])) return false; |
| 668 |
|
| 669 |
switch ($parameters['table']) { |
| 670 |
case 'category_id': |
| 671 |
case 'search_category': |
| 672 |
$model_name = 'category_m'; |
| 673 |
break; |
| 674 |
case 'location_id': |
| 675 |
case 'search_location': |
| 676 |
$model_name = 'location_m'; |
| 677 |
break; |
| 678 |
default: |
| 679 |
# code... |
| 680 |
break; |
| 681 |
} |
| 682 |
|
| 683 |
$key_column = ''; |
| 684 |
$print_column = ''; |
| 685 |
$current_id = '0'; |
| 686 |
|
| 687 |
if(!empty($parameters['id'])) { |
| 688 |
$current_id = intval($parameters['id']); |
| 689 |
} |
| 690 |
|
| 691 |
if(empty($parameters['key_column'])) { |
| 692 |
switch ($model_name) { |
| 693 |
case 'category_m': |
| 694 |
$key_column = 'idcategory'; |
| 695 |
break; |
| 696 |
case 'location_m': |
| 697 |
$key_column = 'idlocation'; |
| 698 |
break; |
| 699 |
|
| 700 |
default: |
| 701 |
# code... |
| 702 |
break; |
| 703 |
} |
| 704 |
} else { |
| 705 |
$key_column = $parameters['key_column']; |
| 706 |
} |
| 707 |
|
| 708 |
if(empty($parameters['print_column'])) { |
| 709 |
switch ($model_name) { |
| 710 |
case 'category_m': |
| 711 |
$print_column = 'category_title'; |
| 712 |
break; |
| 713 |
case 'location_m': |
| 714 |
$print_column = 'location_title'; |
| 715 |
break; |
| 716 |
|
| 717 |
default: |
| 718 |
# code... |
| 719 |
break; |
| 720 |
} |
| 721 |
} else { |
| 722 |
$print_column = $parameters['print_column']; |
| 723 |
} |
| 724 |
|
| 725 |
$this->load->model($model_name); |
| 726 |
|
| 727 |
$db_results = $this->$model_name->get_by(array('parent_id = '.$current_id => NULL)); |
| 728 |
$level = 5; |
| 729 |
|
| 730 |
if(isset($db_results[0]->level)) { |
| 731 |
$level = $db_results[0]->level; |
| 732 |
} |
| 733 |
|
| 734 |
$data['output'] = $db_results; |
| 735 |
|
| 736 |
if (!$db_results) { |
| 737 |
$data['errors'] = ''; |
| 738 |
} else { |
| 739 |
|
| 740 |
if($model_name == 'category_m') { |
| 741 |
$placeholder_texts = [ |
| 742 |
0 => esc_html__('Select Categories','wpdirectorykit'), |
| 743 |
1 => esc_html__('Select Sub Categories','wpdirectorykit'), |
| 744 |
2 => esc_html__('Select Sub Categories','wpdirectorykit'), |
| 745 |
3 => esc_html__('Select Sub Categories','wpdirectorykit'), |
| 746 |
4 => esc_html__('Select Sub Categories','wpdirectorykit'), |
| 747 |
5 => esc_html__('Select Sub Categories','wpdirectorykit'), |
| 748 |
]; |
| 749 |
} else { |
| 750 |
$placeholder_texts = [ |
| 751 |
0 => esc_html__('Select Country','wpdirectorykit'), |
| 752 |
1 => esc_html__('Select City','wpdirectorykit'), |
| 753 |
2 => esc_html__('Select Neighborhood','wpdirectorykit'), |
| 754 |
3 => esc_html__('Select Sub Area','wpdirectorykit'), |
| 755 |
4 => esc_html__('Select Sub Area','wpdirectorykit'), |
| 756 |
5 => esc_html__('Select Sub Area','wpdirectorykit'), |
| 757 |
]; |
| 758 |
} |
| 759 |
|
| 760 |
if(isset($placeholder_texts[$level])) { |
| 761 |
$placeholder = $placeholder_texts[$level]; |
| 762 |
} else { |
| 763 |
$placeholder = esc_html__('Select Sub Categories','wpdirectorykit'); |
| 764 |
} |
| 765 |
|
| 766 |
$results[] = [ |
| 767 |
'id'=> '', |
| 768 |
'text'=> $placeholder |
| 769 |
]; |
| 770 |
|
| 771 |
foreach($db_results as $row) { |
| 772 |
$results[] = [ |
| 773 |
'id'=> wmvc_show_data($key_column, $row), |
| 774 |
'text'=> esc_html__(trim(wmvc_show_data($print_column, $row)),'wpdirectorykit'), |
| 775 |
]; |
| 776 |
} |
| 777 |
|
| 778 |
} |
| 779 |
|
| 780 |
$data['success'] = true; |
| 781 |
$data['results'] = $results; |
| 782 |
|
| 783 |
//$data['sql'] = $this->db->last_query(); |
| 784 |
$this->output($data); |
| 785 |
} |
| 786 |
|
| 787 |
|
| 788 |
public function search_suggestion($output="", $atts=array(), $instance=NULL) |
| 789 |
{ |
| 790 |
$this->load->load_helper('listing'); |
| 791 |
$this->load->model('category_m'); |
| 792 |
$this->load->model('location_m'); |
| 793 |
$this->load->model('listing_m'); |
| 794 |
|
| 795 |
$data = array(); |
| 796 |
$categories_limit = 10; |
| 797 |
$categories_search_column = array('idcategory','category_title'); |
| 798 |
$locations_limit = 10; |
| 799 |
$locations_search_column = array('idlocation','location_title'); |
| 800 |
|
| 801 |
$results = array(); |
| 802 |
/* |
| 803 |
[ |
| 804 |
'field_key' => 'string', |
| 805 |
'value' => 'string', |
| 806 |
'print' => [ |
| 807 |
'html' => 'string', |
| 808 |
'parsed_html' => [ |
| 809 |
'left_column' => 'string', |
| 810 |
'middle_column' => 'string', |
| 811 |
'right_column' => 'string', |
| 812 |
], |
| 813 |
'parsed_content' => [ |
| 814 |
'icon_class' => 'string', |
| 815 |
'title' => 'string', |
| 816 |
'sub_title' => 'string', |
| 817 |
'right_text' => 'string', |
| 818 |
] |
| 819 |
] |
| 820 |
] |
| 821 |
|
| 822 |
*/ |
| 823 |
|
| 824 |
$data['message'] = __('No message returned!', 'wpdirectorykit'); |
| 825 |
|
| 826 |
$parameters = array(); |
| 827 |
foreach ($_POST as $key => $value) { |
| 828 |
$parameters[$key] = sanitize_text_field($value); |
| 829 |
} |
| 830 |
|
| 831 |
$search_text = ''; |
| 832 |
if(!empty($parameters['search'])) |
| 833 |
$search_text = trim($parameters['search']); |
| 834 |
|
| 835 |
/* Categories */ |
| 836 |
$where = array(); |
| 837 |
if($search_text) { |
| 838 |
$sql_search = ''; |
| 839 |
foreach ($categories_search_column as $column) { |
| 840 |
if(!empty($sql_search)) |
| 841 |
$sql_search .= " OR "; |
| 842 |
|
| 843 |
$sql_search .= " ".esc_sql($column)." LIKE '%".esc_sql($search_text)."%'"; |
| 844 |
} |
| 845 |
$where ["($sql_search)"] = NULL; |
| 846 |
$db_results = $this->category_m->get_pagination($categories_limit, NULL, $where); |
| 847 |
} else { |
| 848 |
$db_results = $this->category_m->get_pagination($categories_limit, NULL, array('parent_id = 0' => NULL)); |
| 849 |
} |
| 850 |
|
| 851 |
if($db_results) foreach($db_results as $row) { |
| 852 |
$results[] = [ |
| 853 |
'field_key' => 'search_category', |
| 854 |
'value' => $row->category_title, |
| 855 |
'print' => [ |
| 856 |
'parsed_content' => [ |
| 857 |
'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-tag', |
| 858 |
'title' => esc_html__($row->category_title, 'wpdirectorykit'), |
| 859 |
'sub_title' => '', |
| 860 |
'right_text' => __('Category', 'wpdirectorykit') |
| 861 |
] |
| 862 |
] |
| 863 |
]; |
| 864 |
} |
| 865 |
|
| 866 |
/* END Categories */ |
| 867 |
|
| 868 |
/* Locations */ |
| 869 |
$where = array(); |
| 870 |
if($search_text) { |
| 871 |
$sql_search = ''; |
| 872 |
foreach ($locations_search_column as $column) { |
| 873 |
if(!empty($sql_search)) |
| 874 |
$sql_search .= " OR "; |
| 875 |
|
| 876 |
$sql_search .= " ".$this->db->prefix."wdk_locations.".esc_sql($column)." LIKE '%".esc_sql($search_text)."%'"; |
| 877 |
} |
| 878 |
$where ["($sql_search)"] = NULL; |
| 879 |
|
| 880 |
$select = $this->db->prefix.'wdk_locations.idlocation, '.$this->db->prefix.'wdk_locations.location_title'; |
| 881 |
$select .= ',location_1.location_title AS location_title_1'; |
| 882 |
|
| 883 |
$this->db->join($this->db->prefix.'wdk_locations AS location_1 ON '.$this->db->prefix.'wdk_locations.parent_id = location_1.idlocation', NULL, 'LEFT'); |
| 884 |
for($i = 2 ; $i <= 2; $i++) { |
| 885 |
$select .= ',location_'.$i.'.location_title AS location_title_'.$i.''; |
| 886 |
$this->db->join($this->db->prefix.'wdk_locations AS location_'.$i.' ON location_'.($i-1).'.parent_id = location_'.$i.'.idlocation', NULL, 'LEFT'); |
| 887 |
} |
| 888 |
$this->db->select($select); |
| 889 |
$db_results = $this->location_m->get_pagination($locations_limit, NULL, $where); |
| 890 |
} else { |
| 891 |
$db_results = $this->location_m->get_pagination($locations_limit, NULL, array('parent_id = 0' => NULL)); |
| 892 |
} |
| 893 |
|
| 894 |
if($db_results) foreach($db_results as $row) { |
| 895 |
$subtitle = ''; |
| 896 |
|
| 897 |
for($i = 1 ; $i <= 2; $i++) { |
| 898 |
if(wmvc_show_data('location_title_'.$i, $row, false)){ |
| 899 |
$subtitle .= wmvc_show_data('location_title_'.$i, $row, false).', '; |
| 900 |
} |
| 901 |
} |
| 902 |
|
| 903 |
$subtitle = substr($subtitle,0,-2); |
| 904 |
|
| 905 |
$results[] = [ |
| 906 |
'field_key' => 'search_location', |
| 907 |
'value' => $row->location_title, |
| 908 |
'print' => [ |
| 909 |
'parsed_content' => [ |
| 910 |
'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-map-marker', |
| 911 |
'title' => esc_html__($row->location_title, 'wpdirectorykit'), |
| 912 |
'sub_title' => esc_html__($subtitle, 'wpdirectorykit'), |
| 913 |
'right_text' => __('Location', 'wpdirectorykit') |
| 914 |
] |
| 915 |
] |
| 916 |
]; |
| 917 |
} |
| 918 |
|
| 919 |
/* END Locations */ |
| 920 |
|
| 921 |
/* address suggestion if empty other */ |
| 922 |
if(empty($results)) { |
| 923 |
$this->db->select('address'); |
| 924 |
$db_results = $this->db->where(array("address LIKE '%".esc_sql($search_text)."%'" => NULL)); |
| 925 |
$this->db->from($this->listing_m->_table_name); |
| 926 |
$this->db->group_by('address'); |
| 927 |
|
| 928 |
$query = $this->db->get(); |
| 929 |
if ($this->db->num_rows() > 0) { |
| 930 |
$db_results = $this->db->results(); |
| 931 |
} else { |
| 932 |
$db_results = array(); |
| 933 |
} |
| 934 |
|
| 935 |
if($db_results) foreach($db_results as $row) { |
| 936 |
$results[] = [ |
| 937 |
'field_key' => 'address', |
| 938 |
'value' => $row->address, |
| 939 |
'print' => [ |
| 940 |
'parsed_content' => [ |
| 941 |
'icon_class' => 'fa fa-map-marker', |
| 942 |
'title' => $row->address, |
| 943 |
'sub_title' => '', |
| 944 |
'right_text' => __('Address', 'wpdirectorykit') |
| 945 |
] |
| 946 |
] |
| 947 |
]; |
| 948 |
} |
| 949 |
} |
| 950 |
|
| 951 |
if(empty($results)) { |
| 952 |
|
| 953 |
$name_part = str_replace(' ','+',$search_text); |
| 954 |
|
| 955 |
//$url = 'http://photon.komoot.de/api/?q='.$name_part; |
| 956 |
$url = 'https://api.teleport.org/api/cities/?limit=1&search='.$name_part; |
| 957 |
|
| 958 |
$request = wp_remote_get( $url ); |
| 959 |
$response = ''; |
| 960 |
|
| 961 |
// request failed |
| 962 |
if ( is_wp_error( $request ) ) { |
| 963 |
$response = $request; |
| 964 |
} |
| 965 |
$code = (int) wp_remote_retrieve_response_code( $request ); |
| 966 |
|
| 967 |
// make sure the fetch was successful |
| 968 |
if (empty($response) && $code == 200 ) { |
| 969 |
$response = wp_remote_retrieve_body( $request ); |
| 970 |
|
| 971 |
// Decode the json |
| 972 |
$resp = json_decode( $response,true ); |
| 973 |
if(!empty($resp) && isset($resp['_embedded']) && isset($resp["_embedded"]["city:search-results"]) && !empty($resp["_embedded"]["city:search-results"])) { |
| 974 |
foreach($resp["_embedded"]["city:search-results"] as $prediction) |
| 975 |
{ |
| 976 |
if(isset($prediction["matching_full_name"])){ |
| 977 |
$results[] = [ |
| 978 |
'field_key' => 'search_location', |
| 979 |
'value' => $prediction["matching_full_name"], |
| 980 |
'print' => [ |
| 981 |
'parsed_content' => [ |
| 982 |
'icon_class' => 'fa fa-map-marker', |
| 983 |
'title' => $prediction["matching_full_name"], |
| 984 |
'sub_title' => '', |
| 985 |
'right_text' => '' |
| 986 |
] |
| 987 |
] |
| 988 |
]; |
| 989 |
|
| 990 |
} |
| 991 |
break; |
| 992 |
} |
| 993 |
} |
| 994 |
} |
| 995 |
} |
| 996 |
|
| 997 |
$data['success'] = true; |
| 998 |
$data['results'] = $results; |
| 999 |
|
| 1000 |
//$data['sql'] = $this->db->last_query(); |
| 1001 |
$this->output($data); |
| 1002 |
} |
| 1003 |
|
| 1004 |
public function booking_price_calculate() { |
| 1005 |
$data = array(); |
| 1006 |
$data['success'] = false; |
| 1007 |
|
| 1008 |
$this->load->load_helper('listing'); |
| 1009 |
global $Winter_MVC_wdk_bookings; |
| 1010 |
|
| 1011 |
$Winter_MVC_wdk_bookings->model('reservation_m'); |
| 1012 |
$Winter_MVC_wdk_bookings->model('calendar_m'); |
| 1013 |
|
| 1014 |
$results = array(); |
| 1015 |
$parameters = array(); |
| 1016 |
foreach ($_POST as $key => $value) { |
| 1017 |
$parameters[sanitize_text_field($key)] = sanitize_text_field($value); |
| 1018 |
} |
| 1019 |
|
| 1020 |
$post_id = NULL; |
| 1021 |
$date_from = NULL; |
| 1022 |
$date_to = NULL; |
| 1023 |
|
| 1024 |
if(isset($parameters['post_id'])) { |
| 1025 |
$post_id = $parameters['post_id']; |
| 1026 |
} |
| 1027 |
|
| 1028 |
if(isset($parameters['date_from'])) { |
| 1029 |
$date_from = wdk_normalize_date_db($parameters['date_from']); |
| 1030 |
} |
| 1031 |
|
| 1032 |
if(isset($parameters['date_to'])) { |
| 1033 |
$date_to = wdk_normalize_date_db($parameters['date_to']); |
| 1034 |
} |
| 1035 |
|
| 1036 |
if($post_id && $date_from && $date_to) { |
| 1037 |
$price = $Winter_MVC_wdk_bookings->reservation_m->calculate_price($post_id, $date_from, $date_to); |
| 1038 |
|
| 1039 |
$calendar = $Winter_MVC_wdk_bookings->calendar_m->get_by(array('post_id'=>$post_id), TRUE); // date_package_expire package_id |
| 1040 |
$calendar_fees = array(); |
| 1041 |
if($calendar && !empty($calendar->json_data_fees)) |
| 1042 |
$calendar_fees = json_decode($calendar->json_data_fees ); |
| 1043 |
|
| 1044 |
$results['symbol'] = ''; |
| 1045 |
if(function_exists('wdk_booking_currency_symbol')) |
| 1046 |
$results['symbol'] = wdk_booking_currency_symbol(); |
| 1047 |
|
| 1048 |
if($price) { |
| 1049 |
$results['price'] = $price['price']; |
| 1050 |
$results['total'] = $price['price']; |
| 1051 |
$results['fees'] = array(); |
| 1052 |
foreach ($calendar_fees as $fee) { |
| 1053 |
if(!wmvc_show_data('is_activated', $fee, false,TRUE,TRUE)) continue; |
| 1054 |
if(is_intval(wmvc_show_data('value', $fee,'',TRUE,TRUE))) { |
| 1055 |
$field = str_replace(' ','_',strtolower(esc_html(wmvc_show_data('title', $fee,'-',TRUE,TRUE)))); |
| 1056 |
if(!wmvc_show_data('is_required', $fee, false,TRUE,TRUE) && isset($parameters['fee_'.$field]) && $parameters['fee_'.$field] == 0) { |
| 1057 |
|
| 1058 |
} else { |
| 1059 |
$price = 0; |
| 1060 |
if(wmvc_show_data('calculation_base', $fee,'',TRUE,TRUE) == 'per_night') { |
| 1061 |
$nights = (int)abs(strtotime($date_from) - strtotime($date_to))/(60*60*24); |
| 1062 |
$price += intval(wmvc_show_data('value', $fee,'',TRUE,TRUE)) * $nights; |
| 1063 |
} else if(wmvc_show_data('calculation_base', $fee,'',TRUE,TRUE) == 'per_person') { |
| 1064 |
$price += intval(wmvc_show_data('value', $fee,'',TRUE,TRUE)) * intval(wmvc_show_data('guests', $_POST, 0,TRUE,TRUE)); |
| 1065 |
} else { |
| 1066 |
$price += intval(wmvc_show_data('value', $fee,'',TRUE,TRUE)); |
| 1067 |
} |
| 1068 |
$results['fees'][wmvc_show_data('title', $fee,'',TRUE,TRUE)] = $price; |
| 1069 |
$results['total'] += $price; |
| 1070 |
} |
| 1071 |
} |
| 1072 |
} |
| 1073 |
$data['success'] = true; |
| 1074 |
} else { |
| 1075 |
$data['popup_text_error'] = __('Those dates are not available', 'wpdirectorykit'); |
| 1076 |
} |
| 1077 |
} |
| 1078 |
|
| 1079 |
|
| 1080 |
$data['results'] = $results; |
| 1081 |
|
| 1082 |
//$data['sql'] = $this->db->last_query(); |
| 1083 |
$this->output($data); |
| 1084 |
} |
| 1085 |
|
| 1086 |
private function get_fa_icons() { |
| 1087 |
return array("fa fa-500px","fa fa-address-book","fa fa-address-book-o","fa fa-address-card","fa fa-address-card-o","fa fa-adjust","fa fa-adn","fa fa-align-center","fa fa-align-justify","fa fa-align-left","fa fa-align-right", |
| 1088 |
"fa fa-amazon","fa fa-ambulance","fa fa-american-sign-language-interpreting","fa fa-anchor","fa fa-android","fa fa-angellist","fa fa-angle-double-down","fa fa-angle-double-left","fa fa-angle-double-right","fa fa-angle-double-up", |
| 1089 |
"fa fa-angle-down","fa fa-angle-left","fa fa-angle-right","fa fa-angle-up","fa fa-apple","fa fa-archive","fa fa-area-chart","fa fa-arrow-circle-down","fa fa-arrow-circle-left","fa fa-arrow-circle-o-down","fa fa-arrow-circle-o-left", |
| 1090 |
"fa fa-arrow-circle-o-right","fa fa-arrow-circle-o-up","fa fa-arrow-circle-right","fa fa-arrow-circle-up","fa fa-arrow-down","fa fa-arrow-left","fa fa-arrow-right","fa fa-arrow-up","fa fa-arrows","fa fa-arrows-alt","fa fa-arrows-h", |
| 1091 |
"fa fa-arrows-v","fa fa-assistive-listening-systems","fa fa-asterisk","fa fa-at","fa fa-audio-description","fa fa-backward","fa fa-balance-scale","fa fa-ban","fa fa-bandcamp","fa fa-bar-chart","fa fa-barcode","fa fa-bars","fa fa-bath", |
| 1092 |
"fa fa-battery-empty","fa fa-battery-full","fa fa-battery-half","fa fa-battery-quarter","fa fa-battery-three-quarters","fa fa-bed","fa fa-beer","fa fa-behance","fa fa-behance-square","fa fa-bell","fa fa-bell-o","fa fa-bell-slash", |
| 1093 |
"fa fa-bell-slash-o","fa fa-bicycle","fa fa-binoculars","fa fa-birthday-cake","fa fa-bitbucket","fa fa-bitbucket-square","fa fa-black-tie","fa fa-blind","fa fa-bluetooth","fa fa-bluetooth-b","fa fa-bold","fa fa-bolt","fa fa-bomb","fa fa-book", |
| 1094 |
"fa fa-bookmark","fa fa-bookmark-o","fa fa-braille","fa fa-briefcase","fa fa-btc","fa fa-bug","fa fa-building","fa fa-building-o","fa fa-bullhorn","fa fa-bullseye","fa fa-bus","fa fa-buysellads","fa fa-calculator","fa fa-calendar", |
| 1095 |
"fa fa-calendar-check-o","fa fa-calendar-minus-o","fa fa-calendar-o","fa fa-calendar-plus-o","fa fa-calendar-times-o","fa fa-camera","fa fa-camera-retro","fa fa-car","fa fa-caret-down","fa fa-caret-left","fa fa-caret-right", |
| 1096 |
"fa fa-caret-square-o-down","fa fa-caret-square-o-left","fa fa-caret-square-o-right","fa fa-caret-square-o-up","fa fa-caret-up","fa fa-cart-arrow-down","fa fa-cart-plus","fa fa-cc","fa fa-cc-amex","fa fa-cc-diners-club", |
| 1097 |
"fa fa-cc-discover","fa fa-cc-jcb","fa fa-cc-mastercard","fa fa-cc-paypal","fa fa-cc-stripe","fa fa-cc-visa","fa fa-certificate","fa fa-chain-broken","fa fa-check","fa fa-check-circle","fa fa-check-circle-o","fa fa-check-square", |
| 1098 |
"fa fa-check-square-o","fa fa-chevron-circle-down","fa fa-chevron-circle-left","fa fa-chevron-circle-right","fa fa-chevron-circle-up","fa fa-chevron-down","fa fa-chevron-left","fa fa-chevron-right","fa fa-chevron-up","fa fa-child", |
| 1099 |
"fa fa-chrome","fa fa-circle","fa fa-circle-o","fa fa-circle-o-notch","fa fa-circle-thin","fa fa-clipboard","fa fa-clock-o","fa fa-clone","fa fa-cloud","fa fa-cloud-download","fa fa-cloud-upload","fa fa-code","fa fa-code-fork","fa fa-codepen", |
| 1100 |
"fa fa-codiepie","fa fa-coffee","fa fa-cog","fa fa-cogs","fa fa-columns","fa fa-comment","fa fa-comment-o","fa fa-commenting","fa fa-commenting-o","fa fa-comments","fa fa-comments-o","fa fa-compass","fa fa-compress","fa fa-connectdevelop", |
| 1101 |
"fa fa-contao","fa fa-copyright","fa fa-creative-commons","fa fa-credit-card","fa fa-credit-card-alt","fa fa-crop","fa fa-crosshairs","fa fa-css3","fa fa-cube","fa fa-cubes","fa fa-cutlery","fa fa-dashcube","fa fa-database","fa fa-deaf", |
| 1102 |
"fa fa-delicious","fa fa-desktop","fa fa-deviantart","fa fa-diamond","fa fa-digg","fa fa-dot-circle-o","fa fa-download","fa fa-dribbble","fa fa-dropbox","fa fa-drupal","fa fa-edge","fa fa-eercast","fa fa-eject","fa fa-ellipsis-h","fa fa-ellipsis-v", |
| 1103 |
"fa fa-empire","fa fa-envelope","fa fa-envelope-o","fa fa-envelope-open","fa fa-envelope-open-o","fa fa-envelope-square","fa fa-envira","fa fa-eraser","fa fa-etsy","fa fa-eur","fa fa-exchange","fa fa-exclamation","fa fa-exclamation-circle", |
| 1104 |
"fa fa-exclamation-triangle","fa fa-expand","fa fa-expeditedssl","fa fa-external-link","fa fa-external-link-square","fa fa-eye","fa fa-eye-slash","fa fa-eyedropper","fa fa-facebook","fa fa-facebook-official","fa fa-facebook-square", |
| 1105 |
"fa fa-fast-backward","fa fa-fast-forward","fa fa-fax","fa fa-female","fa fa-fighter-jet","fa fa-file","fa fa-file-archive-o","fa fa-file-audio-o","fa fa-file-code-o","fa fa-file-excel-o","fa fa-file-image-o","fa fa-file-o","fa fa-file-pdf-o", |
| 1106 |
"fa fa-file-powerpoint-o","fa fa-file-text","fa fa-file-text-o","fa fa-file-video-o","fa fa-file-word-o","fa fa-files-o","fa fa-film","fa fa-filter","fa fa-fire","fa fa-fire-extinguisher","fa fa-firefox","fa fa-first-order","fa fa-flag", |
| 1107 |
"fa fa-flag-checkered","fa fa-flag-o","fa fa-flask","fa fa-flickr","fa fa-floppy-o","fa fa-folder","fa fa-folder-o","fa fa-folder-open","fa fa-folder-open-o","fa fa-font","fa fa-font-awesome","fa fa-fonticons","fa fa-fort-awesome","fa fa-forumbee", |
| 1108 |
"fa fa-forward","fa fa-foursquare","fa fa-free-code-camp","fa fa-frown-o","fa fa-futbol-o","fa fa-gamepad","fa fa-gavel","fa fa-gbp","fa fa-genderless","fa fa-get-pocket","fa fa-gg","fa fa-gg-circle","fa fa-gift","fa fa-git","fa fa-git-square", |
| 1109 |
"fa fa-github","fa fa-github-alt","fa fa-github-square","fa fa-gitlab","fa fa-glass","fa fa-glide","fa fa-glide-g","fa fa-globe","fa fa-google","fa fa-google-plus","fa fa-google-plus-official","fa fa-google-plus-square","fa fa-google-wallet", |
| 1110 |
"fa fa-graduation-cap","fa fa-gratipay","fa fa-grav","fa fa-h-square","fa fa-hacker-news","fa fa-hand-lizard-o","fa fa-hand-o-down","fa fa-hand-o-left","fa fa-hand-o-right","fa fa-hand-o-up","fa fa-hand-paper-o","fa fa-hand-peace-o", |
| 1111 |
"fa fa-hand-pointer-o","fa fa-hand-rock-o","fa fa-hand-scissors-o","fa fa-hand-spock-o","fa fa-handshake-o","fa fa-hashtag","fa fa-hdd-o","fa fa-header","fa fa-headphones","fa fa-heart","fa fa-heart-o","fa fa-heartbeat","fa fa-history", |
| 1112 |
"fa fa-home","fa fa-hospital-o","fa fa-hourglass","fa fa-hourglass-end","fa fa-hourglass-half","fa fa-hourglass-o","fa fa-hourglass-start","fa fa-houzz","fa fa-html5","fa fa-i-cursor","fa fa-id-badge","fa fa-id-card","fa fa-id-card-o", |
| 1113 |
"fa fa-ils","fa fa-imdb","fa fa-inbox","fa fa-indent","fa fa-industry","fa fa-info","fa fa-info-circle","fa fa-inr","fa fa-instagram","fa fa-internet-explorer","fa fa-ioxhost","fa fa-italic","fa fa-joomla","fa fa-jpy","fa fa-jsfiddle","fa fa-key", |
| 1114 |
"fa fa-keyboard-o","fa fa-krw","fa fa-language","fa fa-laptop","fa fa-lastfm","fa fa-lastfm-square","fa fa-leaf","fa fa-leanpub","fa fa-lemon-o","fa fa-level-down","fa fa-level-up","fa fa-life-ring","fa fa-lightbulb-o","fa fa-line-chart", |
| 1115 |
"fa fa-link","fa fa-linkedin","fa fa-linkedin-square","fa fa-linode","fa fa-linux","fa fa-list","fa fa-list-alt","fa fa-list-ol","fa fa-list-ul","fa fa-location-arrow","fa fa-lock","fa fa-long-arrow-down","fa fa-long-arrow-left", |
| 1116 |
"fa fa-long-arrow-right","fa fa-long-arrow-up","fa fa-low-vision","fa fa-magic","fa fa-magnet","fa fa-male","fa fa-map","fa fa-map-marker","fa fa-map-o","fa fa-map-pin","fa fa-map-signs","fa fa-mars","fa fa-mars-double","fa fa-mars-stroke", |
| 1117 |
"fa fa-mars-stroke-h","fa fa-mars-stroke-v","fa fa-maxcdn","fa fa-meanpath","fa fa-medium","fa fa-medkit","fa fa-meetup","fa fa-meh-o","fa fa-mercury","fa fa-microchip","fa fa-microphone","fa fa-microphone-slash","fa fa-minus", |
| 1118 |
"fa fa-minus-circle","fa fa-minus-square","fa fa-minus-square-o","fa fa-mixcloud","fa fa-mobile","fa fa-modx","fa fa-money","fa fa-moon-o","fa fa-motorcycle","fa fa-mouse-pointer","fa fa-music","fa fa-neuter","fa fa-newspaper-o", |
| 1119 |
"fa fa-object-group","fa fa-object-ungroup","fa fa-odnoklassniki","fa fa-odnoklassniki-square","fa fa-opencart","fa fa-openid","fa fa-opera","fa fa-optin-monster","fa fa-outdent","fa fa-pagelines","fa fa-paint-brush","fa fa-paper-plane", |
| 1120 |
"fa fa-paper-plane-o","fa fa-paperclip","fa fa-paragraph","fa fa-pause","fa fa-pause-circle","fa fa-pause-circle-o","fa fa-paw","fa fa-paypal","fa fa-pencil","fa fa-pencil-square","fa fa-pencil-square-o","fa fa-percent","fa fa-phone", |
| 1121 |
"fa fa-phone-square","fa fa-picture-o","fa fa-pie-chart","fa fa-pied-piper","fa fa-pied-piper-alt","fa fa-pied-piper-pp","fa fa-pinterest","fa fa-pinterest-p","fa fa-pinterest-square","fa fa-plane","fa fa-play","fa fa-play-circle", |
| 1122 |
"fa fa-play-circle-o","fa fa-plug","fa fa-plus","fa fa-plus-circle","fa fa-plus-square","fa fa-plus-square-o","fa fa-podcast","fa fa-power-off","fa fa-print","fa fa-product-hunt","fa fa-puzzle-piece","fa fa-qq","fa fa-qrcode","fa fa-question", |
| 1123 |
"fa fa-question-circle","fa fa-question-circle-o","fa fa-quora","fa fa-quote-left","fa fa-quote-right","fa fa-random","fa fa-ravelry","fa fa-rebel","fa fa-recycle","fa fa-reddit","fa fa-reddit-alien","fa fa-reddit-square","fa fa-refresh", |
| 1124 |
"fa fa-registered","fa fa-renren","fa fa-repeat","fa fa-reply","fa fa-reply-all","fa fa-retweet","fa fa-road","fa fa-rocket","fa fa-rss","fa fa-rss-square","fa fa-rub","fa fa-safari","fa fa-scissors","fa fa-scribd","fa fa-search","fa fa-search-minus", |
| 1125 |
"fa fa-search-plus","fa fa-sellsy","fa fa-server","fa fa-share","fa fa-share-alt","fa fa-share-alt-square","fa fa-share-square","fa fa-share-square-o","fa fa-shield","fa fa-ship","fa fa-shirtsinbulk","fa fa-shopping-bag","fa fa-shopping-basket", |
| 1126 |
"fa fa-shopping-cart","fa fa-shower","fa fa-sign-in","fa fa-sign-language","fa fa-sign-out","fa fa-signal","fa fa-simplybuilt","fa fa-sitemap","fa fa-skyatlas","fa fa-skype","fa fa-slack","fa fa-sliders","fa fa-slideshare","fa fa-smile-o", |
| 1127 |
"fa fa-snapchat","fa fa-snapchat-ghost","fa fa-snapchat-square","fa fa-snowflake-o","fa fa-sort","fa fa-sort-alpha-asc","fa fa-sort-alpha-desc","fa fa-sort-amount-asc","fa fa-sort-amount-desc","fa fa-sort-asc","fa fa-sort-desc", |
| 1128 |
"fa fa-sort-numeric-asc","fa fa-sort-numeric-desc","fa fa-soundcloud","fa fa-space-shuttle","fa fa-spinner","fa fa-spoon","fa fa-spotify","fa fa-square","fa fa-square-o","fa fa-stack-exchange","fa fa-stack-overflow","fa fa-star", |
| 1129 |
"fa fa-star-half","fa fa-star-half-o","fa fa-star-o","fa fa-steam","fa fa-steam-square","fa fa-step-backward","fa fa-step-forward","fa fa-stethoscope","fa fa-sticky-note","fa fa-sticky-note-o","fa fa-stop","fa fa-stop-circle", |
| 1130 |
"fa fa-stop-circle-o","fa fa-street-view","fa fa-strikethrough","fa fa-stumbleupon","fa fa-stumbleupon-circle","fa fa-subscript","fa fa-subway","fa fa-suitcase","fa fa-sun-o","fa fa-superpowers","fa fa-superscript","fa fa-table", |
| 1131 |
"fa fa-tablet","fa fa-tachometer","fa fa-tag","fa fa-tags","fa fa-tasks","fa fa-taxi","fa fa-telegram","fa fa-television","fa fa-tencent-weibo","fa fa-terminal","fa fa-text-height","fa fa-text-width","fa fa-th","fa fa-th-large","fa fa-th-list", |
| 1132 |
"fa fa-themeisle","fa fa-thermometer-empty","fa fa-thermometer-full","fa fa-thermometer-half","fa fa-thermometer-quarter","fa fa-thermometer-three-quarters","fa fa-thumb-tack","fa fa-thumbs-down","fa fa-thumbs-o-down", |
| 1133 |
"fa fa-thumbs-o-up","fa fa-thumbs-up","fa fa-ticket","fa fa-times","fa fa-times-circle","fa fa-times-circle-o","fa fa-tint","fa fa-toggle-off","fa fa-toggle-on","fa fa-trademark","fa fa-train","fa fa-transgender","fa fa-transgender-alt", |
| 1134 |
"fa fa-trash","fa fa-trash-o","fa fa-tree","fa fa-trello","fa fa-tripadvisor","fa fa-trophy","fa fa-truck","fa fa-try","fa fa-tty","fa fa-tumblr","fa fa-tumblr-square","fa fa-twitch","fa fa-twitter","fa fa-twitter-square","fa fa-umbrella", |
| 1135 |
"fa fa-underline","fa fa-undo","fa fa-universal-access","fa fa-university","fa fa-unlock","fa fa-unlock-alt","fa fa-upload","fa fa-usb","fa fa-usd","fa fa-user","fa fa-user-circle","fa fa-user-circle-o","fa fa-user-md","fa fa-user-o", |
| 1136 |
"fa fa-user-plus","fa fa-user-secret","fa fa-user-times","fa fa-users","fa fa-venus","fa fa-venus-double","fa fa-venus-mars","fa fa-viacoin","fa fa-viadeo","fa fa-viadeo-square","fa fa-video-camera","fa fa-vimeo","fa fa-vimeo-square","fa fa-vine", |
| 1137 |
"fa fa-vk","fa fa-volume-control-phone","fa fa-volume-down","fa fa-volume-off","fa fa-volume-up","fa fa-weibo","fa fa-weixin","fa fa-whatsapp","fa fa-wheelchair","fa fa-wheelchair-alt","fa fa-wifi","fa fa-wikipedia-w","fa fa-window-close", |
| 1138 |
"fa fa-window-close-o","fa fa-window-maximize","fa fa-window-minimize","fa fa-window-restore","fa fa-windows","fa fa-wordpress","fa fa-wpbeginner","fa fa-wpexplorer","fa fa-wpforms","fa fa-wrench","fa fa-xing","fa fa-xing-square", |
| 1139 |
"fa fa-y-combinator","fa fa-yahoo","fa fa-yelp","fa fa-yoast","fa fa-youtube","fa fa-youtube-play","fa fa-youtube-square"); |
| 1140 |
} |
| 1141 |
|
| 1142 |
} |
| 1143 |
|