tax($abprf_infos); $this->post_faq($abprf_infos); $this->post_tc($abprf_infos); ?>
global_faq(); $this->global_tc(); } public function tax($abprf_infos = []): void { $tax_status = $abprf_infos['_tax_status'] ?? ''; $tax_classes = WC_Tax::get_tax_rate_classes(); $tax_class = $abprf_infos['_tax_class'] ?? ''; ?>
๐Ÿงพ
โ“
faq($faqs); ?>
๐Ÿค
tc($abprf_tc); ?>
๐Ÿค
tc($tcs); ?>
โ“
faq($faqs, true); ?>
'tc_content', 'textarea_rows' => 12, 'media_buttons' => true, 'teeny' => false, 'quicktags' => true ) ); ?>
0) { foreach ($faqs as $faq) { $this->faq_item($faq); } } ?>
faq_item(); ?>
'faq_description[]', 'textarea_rows' => 6, 'media_buttons' => true, 'teeny' => false, 'quicktags' => true ) ); ?>
'', '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_html = fn($key, $default = '') => isset($_POST[$key]) ? wp_kses_post(wp_unslash($_POST[$key])) : $default; update_option('abprf_tc', $post_html('tc_content')); wp_send_json_success(['msg' => __('Term & Conditions Saved Successfully..... !! ', 'abp-rentalforge')]); } public function get_faq_array(array $abprf_faqs = []): array { $has_post_nonce = isset($_POST['abprf_post_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['abprf_post_nonce'])), 'abprf_post_nonce'); $has_ajax_nonce = check_ajax_referer('abprf_admin_ajax_nonce', 'nonce', false); if (($has_post_nonce || $has_ajax_nonce) && current_user_can('manage_options')) { $post_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('sanitize_text_field', wp_unslash($_POST[$key])) : []; $post_html_array = fn($key) => (isset($_POST[$key]) && is_array($_POST[$key])) ? array_map('wp_kses_post', wp_unslash($_POST[$key])) : []; $titles = $post_array('faq_title'); $descriptions = $post_html_array('faq_description'); if (!empty($titles)) { foreach ($titles as $key => $title) { if ($title && !empty($descriptions[$key])) { $abprf_faqs[$key] = [ 'title' => $title, 'des' => $descriptions[$key], ]; } } } } return $abprf_faqs; } public function save_faqs(): void { if (!check_ajax_referer('abprf_admin_ajax_nonce', 'nonce', false)) { wp_send_json_error(['msg' => __('Invalid security token.', 'abp-rentalforge')], 403); } if (!current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Insufficient permissions.', 'abp-rentalforge')], 403); } $abprf_faqs = $this->get_faq_array(); update_option('abprf_faqs', $abprf_faqs); wp_send_json_success(['msg' => __('FAQs Configuration Saved Successfully..... !! ', 'abp-rentalforge')]); } public function import_tc(): 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); } $tcs = ABPRF_Function::get_option('abprf_tc', ''); ob_start(); $this->tc($tcs); $html_content = ob_get_clean(); wp_send_json_success(['html' => $html_content, 'msg' => __('Term & Conditions Imported Successfully ..... !! ', 'abp-rentalforge')]); } public function import_faq(): 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); } $faqs = ABPRF_Function::get_option('abprf_faqs'); $faqs = is_array($faqs) ? $faqs : []; ob_start(); $this->faq($faqs); $html_content = ob_get_clean(); wp_send_json_success(['html' => $html_content, 'msg' => __('FAQ ImportedSuccessfully ..... !! ', 'abp-rentalforge')]); } } new ABPRF_Resource(); }