โ“
faq_config(); ?>
๐Ÿค
tc_config(); ?>
faq($faqs, true); ?>
0) { foreach ($faqs as $faq) { $this->faq_item($faq); } } ?>
faq_item(); ?>
'faq_description[]', 'textarea_rows' => 6, 'media_buttons' => true, 'teeny' => false, 'quicktags' => true ) ); ?>
__('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $abpet_faq = $this->get_faq_array(); update_option('abpet_faq', $abpet_faq); ob_start(); $this->faq_config(); $html = ob_get_clean(); wp_send_json_success([ 'html' => $html, 'msg' => __('FAQs Configuration Saved Successfully..... !! ', 'abp-event-ticket'), 'type' => 'success' ]); } public function post_resource($post_infos = []): void { ?>
tax($post_infos); $this->post_faq($post_infos); $this->post_tc($post_infos); ?>
๐Ÿงพ
โ“
faq($faqs); ?>
๐Ÿค
tc($abpet_tc); ?>
tc($tcs); ?>
'tc_content', 'textarea_rows' => 12, 'media_buttons' => true, 'teeny' => false, 'quicktags' => true ) ); ?>
__('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $post_html = fn($key, $default = '') => isset($_POST[$key]) ? wp_kses_post(wp_unslash($_POST[$key])) : $default; update_option('abpet_tc', $post_html('tc_content')); ob_start(); $this->tc_config(); $html = ob_get_clean(); wp_send_json_success([ 'html' => $html, 'msg' => __('Term & Conditions Saved Successfully..... !!', 'abp-event-ticket'), 'type' => 'success' ]); } public function get_faq_array(array $abpet_faq = []): array { $has_post_nonce = isset($_POST['abpet_post_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['abpet_post_nonce'])), 'abpet_post_nonce'); $has_ajax_nonce = check_ajax_referer('abpet_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])) { $abpet_faq[$key] = [ 'title' => $title, 'des' => $descriptions[$key], ]; } } } } return $abpet_faq; } public function import_tc_content(): void { if (!check_ajax_referer('abpet_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $tcs = ABPET_Function::get_option('abpet_tc', ''); ob_start(); $this->tc($tcs); $html_content = ob_get_clean(); wp_send_json_success(['html' => $html_content, 'msg' => __('Global Term & Conditions Imported Successfully ..... !! ', 'abp-event-ticket'), 'type' => 'success']); } public function import_faq_content(): void { if (!check_ajax_referer('abpet_admin_ajax_nonce', 'nonce', false) || !current_user_can('manage_options')) { wp_send_json_error(['msg' => __('Invalid security token or Insufficient permissions.', 'abp-event-ticket'), 'type' => 'warn'], 403); } $faqs = ABPET_Function::get_option('abpet_faq'); $faqs = is_array($faqs) ? $faqs : []; ob_start(); $this->faq($faqs); $html_content = ob_get_clean(); wp_send_json_success(['html' => $html_content, 'msg' => __('FAQ Imported Successfully ..... !! ', 'abp-event-ticket'), 'type' => 'success']); } } new ABPET_Resource(); }