/** * Copyright (C) 2014-2020 ServMask Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ if ( ! defined( 'ABSPATH' ) ) { die( 'Kangaroos cannot jump here' ); } class Ai1wm_Export_Content { public static function execute( $params ) { // Set archive bytes offset if ( isset( $params['archive_bytes_offset'] ) ) { $archive_bytes_offset = (int) $params['archive_bytes_offset']; } else { $archive_bytes_offset = ai1wm_archive_bytes( $params ); } // Set file bytes offset if ( isset( $params['file_bytes_offset'] ) ) { $file_bytes_offset = (int) $params['file_bytes_offset']; } else { $file_bytes_offset = 0; } // Set content bytes offset if ( isset( $params['content_bytes_offset'] ) ) { $content_bytes_offset = (int) $params['content_bytes_offset']; } else { $content_bytes_offset = 0; } // Get processed files size if ( isset( $params['processed_files_size'] ) ) { $processed_files_size = (int) $params['processed_files_size']; } else { $processed_files_size = 0; } // Get total content files size if ( isset( $params['total_content_files_size'] ) ) { $total_content_files_size = (int) $params['total_content_files_size']; } else { $total_content_files_size = 1; } // Get total content files count if ( isset( $params['total_content_files_count'] ) ) { $total_content_files_count = (int) $params['total_content_files_count']; } else { $total_content_files_count = 1; } // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // Flag to hold if file data has been processed $completed = true; // Start time $start = microtime( true ); // Get content list file $content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' ); // Set the file pointer at the current index if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) { // Open the archive file for writing $archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) ); // Set the file pointer to the one that we have saved $archive->set_file_pointer( $archive_bytes_offset ); // Loop over files while ( list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = fgetcsv( $content_list ) ) { $file_bytes_written = 0; // Add file to archive if ( ( $completed = $archive->add_file( $file_abspath, $file_relpath, $file_bytes_written, $file_bytes_offset ) ) ) { $file_bytes_offset = 0; // Get content bytes offset $content_bytes_offset = ftell( $content_list ); } // Increment processed files size $processed_files_size += $file_bytes_written; // What percent of files have we processed? $progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 ); // Set progress Ai1wm_Status::info( sprintf( __( 'Archiving %d content files...
%d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) ); // More than 10 seconds have passed, break and do another request if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) { if ( ( microtime( true ) - $start ) > $timeout ) { $completed = false; break; } } } // Get archive bytes offset $archive_bytes_offset = $archive->get_file_pointer(); // Truncate the archive file $archive->truncate(); // Close the archive file $archive->close(); } // End of the content list? if ( feof( $content_list ) ) { // Unset archive bytes offset unset( $params['archive_bytes_offset'] ); // Unset file bytes offset unset( $params['file_bytes_offset'] ); // Unset content bytes offset unset( $params['content_bytes_offset'] ); // Unset processed files size unset( $params['processed_files_size'] ); // Unset total content files size unset( $params['total_content_files_size'] ); // Unset total content files count unset( $params['total_content_files_count'] ); // Unset completed flag unset( $params['completed'] ); } else { // Set archive bytes offset $params['archive_bytes_offset'] = $archive_bytes_offset; // Set file bytes offset $params['file_bytes_offset'] = $file_bytes_offset; // Set content bytes offset $params['content_bytes_offset'] = $content_bytes_offset; // Set processed files size $params['processed_files_size'] = $processed_files_size; // Set total content files size $params['total_content_files_size'] = $total_content_files_size; // Set total content files count $params['total_content_files_count'] = $total_content_files_count; // Set completed flag $params['completed'] = $completed; } // Close the content list file ai1wm_close( $content_list ); return $params; } } Kiến Thức Kinh Tế - Trang 3 trên 32 - Vay Tài Chính 247

Category Archives: Kiến Thức Kinh Tế

Cách làm bánh bông lan trứng muối tại nhà 100% thành công

Chuẩn bị nguyên liệu Trước khi bắt tay vào làm bánh bông lan trứng muối, bạn cần chuẩn bị đủ nguyên liệu cho hai phần chính: cốt bánh và topping. Nguyên liệu cho cốt bánh Trứng gà: 4 quả (tách riêng lòng trắng và lòng đỏ) Đường: 80g Bột mì đa dụng: 70g Bột bắp: […]

Loài hoa phù hợp với 12 cung hoàng đạo – Chọn đúng để tỏa sáng đúng chất bạn

Mỗi cung hoàng đạo mang một cá tính riêng biệt, từ sự mạnh mẽ của Bạch Dương, vẻ bí ẩn của Thần Nông cho đến sự mộng mơ của Song Ngư. Không chỉ thể hiện qua hành vi hay sở thích, điều này còn phản ánh trong cách lựa chọn hoa yêu thích. Nếu bạn […]

Bánh bông lan trứng muối là gì? Nguồn gốc, hương vị và lý do gây sốt trong giới ẩm thực

Bánh bông lan trứng muối là gì? Bánh bông lan trứng muối là sự kết hợp độc đáo giữa cốt bánh bông lan mềm mịn và topping mặn béo như trứng muối, chà bông, phô mai và sốt mayonnaise. Đây là món bánh kết hợp giữa vị ngọt – mặn – béo rất hài hòa, […]

Cây kim ngân là gì? Nguồn gốc, đặc điểm và ý nghĩa phong thủy

Cây kim ngân là gì? Cây kim ngân là một loại cây cảnh phong thủy nổi bật với khả năng thu hút tài lộc, may mắn và vượng khí cho gia chủ. Tên khoa học của cây là Pachira aquatica, thuộc họ Bombacaceae, có nguồn gốc từ khu vực Trung Mỹ và Nam Mỹ – […]

Cây hạnh phúc là gì? Ý nghĩa phong thủy, công dụng và cách chăm sóc đúng chuẩn

Cây hạnh phúc là gì? Cây hạnh phúc là một loại cây cảnh thuộc họ thực vật thân gỗ nhỏ, có tên khoa học là Radermachera sinica. Cây có nguồn gốc từ các khu rừng nhiệt đới châu Á, đặc biệt phổ biến ở Trung Quốc, Đài Loan và khu vực Đông Nam Á. Đặc […]

10 xu hướng spa và làm đẹp dẫn đầu năm 2025 – Spa của bạn đã sẵn sàng chưa?

Thị trường làm đẹp đang thay đổi nhanh hơn bao giờ hết. Khách hàng ngày càng thông minh, yêu cầu cao hơn và mong muốn trải nghiệm cá nhân hóa, tiện lợi và có chiều sâu. Năm 2025 hứa hẹn sẽ là năm bùng nổ những đổi mới trong ngành spa – từ công nghệ, […]

Các loại lá và hương liệu xông hơi tốt cho sức khỏe giúp thải độc tự nhiên

Trong thời đại mà con người ngày càng hướng về các phương pháp chăm sóc sức khỏe tự nhiên và lành tính, xông hơi bằng lá và hương liệu ngày càng được ưa chuộng. Không chỉ đơn thuần là một liệu pháp thư giãn, xông hơi đúng cách với các thành phần thảo mộc còn […]

Cà khịa là gì? Nguồn gốc, ý nghĩa và cách dùng đúng trong giao tiếp hiện đại

Cà khịa là gì? “Cà khịa” là một từ lóng trong tiếng Việt, phổ biến rộng rãi trong giới trẻ, đặc biệt trên mạng xã hội. Từ này thường được dùng để chỉ hành động trêu chọc, mỉa mai, đụng chạm một cách khéo léo nhằm tạo sự chú ý, phản ứng hoặc gây cười. […]

Chó Poodle là giống gì? Nguồn gốc, đặc điểm và chăm sóc đúng chuẩn

Nguồn gốc và lịch sử phát triển Chó Poodle, còn gọi là chó săn vịt, có nguồn gốc từ châu Âu, tên khoa học bắt nguồn từ từ “Pudel” trong tiếng Đức nghĩa là “thợ lặn” hay “chó nước”. Ban đầu, Poodle được lai tạo để săn và lôi vật thí sinh từ hồ nước […]

Chó phốc sóc là giống gì? Nguồn gốc, đặc điểm và chăm sóc đúng chuẩn

Nguồn gốc của chó phốc sóc Chó phốc sóc, còn gọi là Pomeranian, là một giống chó cảnh có nguồn gốc từ vùng Pomerania thuộc khu vực Trung Âu. Ban đầu, chúng thuộc nhóm chó Spitz cỡ lớn, được nuôi để kéo xe và chăn thả gia súc. Qua quá trình lai tạo và thu […]