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();
}