properties_table($filter_args); ?>
';print_r( ABPRF_Layout::rent_rules_options()); echo ''; ?>

🏠

*
$rule) { ?>
properties_table($filter_args); ?>
'; print_r( $filter_args ); echo ''; $total_property = ABPRF_Query::get_property($filter_args, true); $page_number = is_numeric($filter_args['page_number'] ?? null) ? (int)$filter_args['page_number'] : 1; $limit = is_numeric($filter_args['page_item'] ?? null) ? (int)$filter_args['page_item'] : ABPRF_Function::get_option('abprf_per_page_item', 20); $count = ($page_number - 1) * $limit + 1; $filter_args['limit'] = $limit; $filter_args['offset'] = $page_number - 1; $properties = ABPRF_Query::get_property($filter_args); if (!empty($properties) && is_array($properties) && sizeof($properties) > 0) { $filter_post_id = $filter_args['post_id'] ?? ''; $copy_post_id = $filter_args['copy_post_id'] ?? ''; $rent_rules = ABPRF_Layout::rent_rules_options(); ?>
.
$label) { $price_info = $price_qty_info[$key] ?? []; ?>
'; print_r( $price_info ); echo ''; $price = $price_info['price'] ?? ''; if (!empty($price)) { echo wp_kses_post(wc_price($price)); if ($key == 'multi_day' || $key == 'multi_month') { $price_multi = $price_info['price_multi'] ?? ''; if (!empty($price_multi)) { echo '-' . wp_kses_post(wc_price($price_multi)); } else { echo esc_html('❌'); } } ?>
$limit, 'page_number' => $page_number, 'total' => $total_property, 'style' => 'ajax']); } else { ABPRF_Layout::layout_warning_info('not_property_found'); } //echo '
';				print_r( $properties );				echo '
'; } public function post_rent_continue($property = [], $post_ids = [], $_current_post_id = 0): void { $current_post_id = $property['post_id'] ?? $_current_post_id; $rent_continue = $property['rent_continue'] ?? 'on'; ?>
*
$rule_label) { ?>
'', 'msg' => __('Invalid security token.', 'abp-rentalforge')], 403); } if (!current_user_can('manage_options')) { wp_send_json_error(['html' => '', 'msg' => __('Insufficient permissions.', 'abp-rentalforge')], 403); } $post_val = fn($key, $default = '') => isset($_POST[$key]) ? sanitize_text_field(wp_unslash($_POST[$key])) : $default; $int_val = fn($key, $default = '') => isset($_POST[$key]) ? intval(wp_unslash($_POST[$key])) : $default; $post_textarea = fn($key, $default = '') => isset($_POST[$key]) ? sanitize_textarea_field(wp_unslash($_POST[$key])) : $default; $post_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_text_field', wp_unslash($_POST[$key])) : []; $filter_args = $post_array('filter_args'); $post_id = $int_val('property_post_id'); $property_id = $int_val('property_id'); $name = $post_val('name'); $rent_rule = $post_val('rent_rule'); $_rent_rule = !empty($post_id) ? ABPRF_Function::get_post_info($post_id, 'rent_rule') : ''; $rent_rule = !empty($_rent_rule) ? $_rent_rule : $rent_rule; $rent_rules = ABPRF_Layout::rent_rules_options(); if ($name && $rent_rule) { $price_info = []; $rent_continue = $post_val('rent_continue', 'on'); $qty = $int_val('qty', 1); $reserve = $int_val('qty_reserve', 0); $qty_min = $int_val('qty_min', 0); $qty_max = $int_val('qty_max'); $deposit_info = [ 'type' => $post_val('deposit_type'), 'value' => $post_val('deposit_value'), ]; foreach ($rent_rules as $key => $label) { $price = $post_val('price_' . $key); if (!empty($price)) { $exit = 1; $multi_price = ''; if ($key == 'multi_day' || $key == 'multi_month') { $exit = 0; $multi_price = $post_val('price_' . $key . '_price'); if (!empty($multi_price)) { $exit = 1; } } if ($exit > 0) { $price_info[$key]['qty'] = $qty; $price_info[$key]['reserve'] = $reserve; $price_info[$key]['qty_min'] = $qty_min; $price_info[$key]['qty_max'] = $qty_max; $price_info[$key]['price'] = $price; $price_info[$key]['min'] = $int_val('min_' . $key, 1); $price_info[$key]['max'] = $int_val('max_' . $key); if ($key == 'multi_day' || $key == 'multi_month') { $price_info[$key]['price_multi'] = $multi_price; } $price_info[$key]['deposit'] = $deposit_info; } } } $price_info = apply_filters('abprf_filter_price_info', $price_info, $post_id); $others = [ 'icon' => $post_val('icon'), 'description' => $post_textarea('description') ]; $data = [ 'post_id' => intval($post_id), 'rent_continue' => $rent_continue, 'name' => $name, 'brand' => $post_val('brand'), 'category' => !empty($post_id) ? ABPRF_Function::get_post_info($post_id, 'abprf_category') : '', 'location' => !empty($post_id) ? ABPRF_Function::get_post_info($post_id, 'abprf_location') : '', 'features' => $post_val('feature'), 'rent_rule' => $rent_rule, 'price_qty_info' => wp_json_encode($price_info), 'gallery' => $post_val('abprf_sliders'), 'status' => !empty($post_id) ? get_post_status($post_id) : '', 'others' => wp_json_encode($others), 'updated_at' => current_time('Y-m-d H:i') ]; global $wpdb; $table_name = $wpdb->prefix . 'abprf_property'; if ($property_id) { $where = ['id' => intval($property_id)]; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->update($table_name, $data, $where); $msg = esc_html__('Property Updated Successfully...... !! ', 'abp-rentalforge'); } else { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->insert($table_name, $data); $msg = esc_html__('Property Saved Successfully.... !! ', 'abp-rentalforge'); } ABPRF_Function::update_global_data($post_id); } else { $msg = esc_html__('Property name , Rent rule Can not be Blank . Property not Saved ..... !! ', 'abp-rentalforge'); } ob_start(); $this->properties_table($filter_args); $html = ob_get_clean(); wp_send_json_success(['html' => $html, 'msg' => $msg]); } public function add_property(): void { if (!check_ajax_referer('abprf_admin_ajax_nonce', 'nonce', false)) { wp_send_json_error(['html' => '', 'msg' => __('Invalid security token.', 'abp-rentalforge')], 403); } if (!current_user_can('manage_options')) { wp_send_json_error(['html' => '', 'msg' => __('Insufficient permissions.', 'abp-rentalforge')], 403); } ob_start(); $post_int = fn($key, $default = '') => isset($_POST[$key]) ? absint(wp_unslash($_POST[$key])) : $default; $property_id = $post_int('tax_id'); $current_post_id = $post_int('post_id'); $property_copy = $post_int('property_copy', 0); $post_ids = ABPRF_Query::get_post_id(['status' => ['publish', 'draft', 'private', 'trash']]); $save_text = __('Save Property Configuration', 'abp-rentalforge'); $property = []; if ($property_id) { $properties = ABPRF_Query::get_property(['property_id' => $property_id]); if (!empty($properties) && is_array($properties) && sizeof($properties) > 0) { $property = current($properties); $save_text = __('Update Property Configuration', 'abp-rentalforge'); } if ($property_copy > 0) { $property_id = ''; $save_text = __('Copy Property Configuration', 'abp-rentalforge'); } } ?>
post_rent_continue($property, $post_ids, $current_post_id); $this->name_image_icon($property); $this->brand_description($property); $this->property_price_qty($property, $current_post_id); if (method_exists($this, 'features')) { $this->features($property); } if (method_exists($this, 'gallery')) { $this->gallery($property); } ?>
$html, 'msg' => __('Property Form Loaded Successfully .....! ', 'abp-rentalforge')]); } public function reload_property_list(): void { if (!check_ajax_referer('abprf_admin_ajax_nonce', 'nonce', false)) { wp_send_json_error(['html' => '', 'msg' => __('Invalid security token.', 'abp-rentalforge')], 403); } if (!current_user_can('manage_options')) { wp_send_json_error(['html' => '', 'msg' => __('Insufficient permissions.', 'abp-rentalforge')], 403); } ob_start(); $post_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_text_field', wp_unslash($_POST[$key])) : []; $filter_args = $post_array('filter_args'); $post_id = ($filter_args['post_id'] ?? 'all') ?: 'all'; $filter_args['post_id'] = $post_id; $this->properties_table($filter_args); $table_html = ob_get_clean(); wp_send_json_success(['html' => $table_html, 'msg' => __('Property List Loaded successfully...... !! ', 'abp-rentalforge')]); } public function property_delete(): void { if (!check_ajax_referer('abprf_admin_ajax_nonce', 'nonce', false)) { wp_send_json_error(['html' => '', 'msg' => __('Invalid security token.', 'abp-rentalforge')], 403); } if (!current_user_can('manage_options')) { wp_send_json_error(['html' => '', 'msg' => __('Insufficient permissions.', 'abp-rentalforge')], 403); } $property_id = isset($_POST['property_id']) ? sanitize_text_field(wp_unslash($_POST['property_id'])) : ''; if (!empty($property_id) && $property_id > 0) { $properties = ABPRF_Query::get_property(['property_id' => $property_id]); if (!empty($properties) && sizeof($properties) > 0) { global $wpdb; $table_name = $wpdb->prefix . 'abprf_property'; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->delete($table_name, array('id' => intval($property_id)), array('%d')); } } ob_start(); $post_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_text_field', wp_unslash($_POST[$key])) : []; $filter_args = $post_array('filter_args'); $post_id = ($filter_args['post_id'] ?? 'all') ?: 'all'; $filter_args['post_id'] = $post_id; $this->properties_table($filter_args); $html = ob_get_clean(); wp_send_json_success(['html' => $html, 'msg' => esc_html__('Deleted Successfully............. ! ', 'abp-rentalforge')]); } } new ABPRF_Properties(); }