0
Your Rating
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; add_action('wp_ajax_mme_export', function(){ if (!current_user_can('manage_options')) wp_die('Không đủ quyền.'); $ids = json_decode(stripslashes($_POST['ids'] ?? '[]'), true); if (empty($ids)) wp_die('No IDs selected'); // Include autoload PhpSpreadsheet nếu chưa include if (!class_exists('PhpOffice\PhpSpreadsheet\Spreadsheet')) { require_once __DIR__ . '/vendor/autoload.php'; } $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); // Tiêu đề cột theo thứ tự mong muốn $sheet->fromArray(['Content', 'Title', 'ID', 'Thumbnail'], null, 'A1'); $row_num = 2; // dữ liệu bắt đầu từ dòng 2 global $wp_manga_functions; foreach ((array)$ids as $i => $manga_id) { $post = get_post($manga_id); if (!$post || $post->post_type !== 'wp-manga') continue; $payload = mme_get_first_chapter_payload($post->ID); // Bỏ truyện rỗng nội dung chương 1 $chapter_text = trim($payload['content'] ?? ''); if ($chapter_text === '') continue; // Bỏ truyện không có thumbnail if (!has_post_thumbnail($post->ID)) continue; $thumb_url = get_the_post_thumbnail_url($post->ID, 'full'); // GHÉP CONTENT $content = "#truyenful #truyenmoihay\n📚\n"; $content .= $chapter_text . "\n\n"; $cta_list = [ 'LINH FULL ĐÃ ĐƯỢC GHIM! Để đường dẫn hiển thị rõ ràng. KÉO XUỐNG CMT, nhớ BẬT XEM TẤT CẢ để thấy linh nha mọi người!', 'Truyện FULL đã được ghim! 🚀 Kéo xuống phần CMT, bật XEM TẤT CẢ để không bỏ lỡ nha mọi người!', 'ĐỪNG LƯỚT QUA! LINH FULL có sẵn, kéo xuống phần CMT và bật XEM TẤT CẢ để lấy link ngay!', 'Cập nhật FULL rồi nè! ⬇️ Kéo xuống comment, nhớ bật XEM TẤT CẢ để nhận link nha cả nhà!', 'LINH FULL đã sẵn sàng! Kéo xuống CMT, bật XEM TẤT CẢ để đường dẫn hiển thị đầy đủ!' ]; $content .= $cta_list[array_rand($cta_list)] . "\n\n"; $content .= $post->ID; // Ghi vào sheet theo thứ tự Content, Title, ID, Thumbnail $sheet->setCellValue("A{$row_num}", $content); $sheet->setCellValue("B{$row_num}", html_entity_decode($post->post_title, ENT_QUOTES | ENT_HTML5, 'UTF-8')); $sheet->setCellValue("C{$row_num}", $post->ID); $sheet->setCellValue("D{$row_num}", $thumb_url); $row_num++; // Đánh dấu đã export update_post_meta($post->ID, '_mme_exported', 1); } // Xuất file Excel $writer = new Xlsx($spreadsheet); $filename = 'manga-export-' . date('Y-m-d_H-i') . '.xlsx'; header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Cache-Control: max-age=0'); $writer->save('php://output'); exit; });
Thực tập sinh lén hôn chồng liên hôn của tôi, và tôi bắt gặp cảnh đó.
Cô ta luống cuống quỳ xuống, nước mắt lưng tròng:
“Phu nhân, xin người tha cho tôi.”
Kiếp trước, tôi làm ầm lên một trận, giận dỗi ly hôn với Phó Yến Lễ.
Cuối cùng mất đi chỗ dựa nhà họ Phó, không nơi nương tựa, chết thảm trên đường đi giao đồ ăn.
Sống lại một đời, Phó Yến Lễ hờ hững nhìn tôi:
“Sao, đại tiểu thư nhà họ Tạ muốn ly hôn với tôi à?”
Tôi không trả lời.
Chỉ dịu dàng nắm lấy tay cô gái kia:
“Em gái, sau này vất vả em cùng chị chăm sóc A Lễ nhé.”
“Chỉ cần anh ấy vui, chị thế nào cũng được.”
Khóe mắt tôi thoáng liếc qua.
Người đàn ông kia, sắc mặt lập tức trắng bệch.