/** * 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 14 trên 32 - Vay Tài Chính 247

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

Mã số thuế cá nhân và cách tra cứu nhanh chóng

Trong bài viết này, chúng ta sẽ tìm hiểu về mã số thuế cá nhân và cách tra cứu nhanh chóng để giúp mọi người hiểu rõ hơn về vấn đề này. Mã số thuế cá nhân là một yếu tố quan trọng trong hệ thống thuế và tài chính. Việc tra cứu và sở […]

Chiếu điều hòa là gì? Chiếu điều hòa có giặt được không?

Chiếu điều hòa là gì? Chiếu điều hòa là một sản phẩm giường ngủ được làm từ các chất liệu cao cấp, với khả năng giúp người dùng có được giấc ngủ mát mẻ và thoải mái ngay cả trong những ngày hè nóng bức. Các chất liệu phổ biến nhất được sử dụng để […]

Giá, đặc điểm, cách chăm sóc chó Alaska

Chó Alaska là một giống chó lớn, có nguồn gốc từ Alaska, Hoa Kỳ. Chúng được biết đến với kích thước to lớn, sức mạnh và sự trung thành. Chó Alaska được sử dụng chủ yếu để kéo xe trượt tuyết trong thời tiết lạnh giá. Tuy nhiên, ngày nay, chúng cũng được nuôi làm […]

Argentina vô địch và Lionel Messi là người hùng

Chào mừng đến với bài viết bổ ích về cuộc đua sôi động tại World Cup 2022! Sau 36 năm chờ đợi, Argentina đã từng bước vượt qua mọi trở ngại và đăng quang vô địch trong trận chung kết. Hãy cùng chúng tôi khám phá những thông tin thú vị về giải đấu này, […]

5 loại bếp ga mini tiện lợi và an toàn

Bếp ga mini là gì? Bếp ga mini là một thiết bị gia dụng nhỏ gọn, tiện lợi, được sử dụng để nấu nướng các món ăn đơn giản như mì, phở, cháo,… Bếp ga mini có nhiều ưu điểm như giá thành rẻ, dễ sử dụng, không cần phải có nguồn điện,… nên rất […]

Bảng cân đối kế toán là gì? Cấu trúc và Ý nghĩa

Bảng cân đối kế toán (tiếng Anh: Balance sheet) là một bảng tổng hợp giá trị tài sản, nợ phải trả và vốn chủ sở hữu của một doanh nghiệp tại một thời điểm nhất định. Nó cung cấp một bức tranh tổng quan về tình hình tài chính của doanh nghiệp, cho thấy các […]

Bảo hiểm xã hội là gì? Vai trò, quy định và quyền lợi?

Khái niệm và vai trò của bảo hiểm xã hội Bảo hiểm xã hội là một khái niệm quan trọng trong lĩnh vực an sinh xã hội tại Việt Nam. Nó đảm bảo rằng khi người lao động gặp rủi ro như mất đi thu nhập do bị ốm đau, thai sản, tai nạn lao […]

Thẻ Napas là gì? Các loại thẻ Napas phổ biến

Thẻ Napas là thẻ thanh toán do Napas phát hành, được sử dụng rộng rãi tại Việt Nam và một số nước trong khu vực. Napas là viết tắt của National Payment Network, là tổ chức trung gian thanh toán được thành lập bởi các ngân hàng trong nước. Napas có chức năng kết nối […]

Chỉ số PMI là gì? Cách tính và ý nghĩa của chỉ số PMI

Chỉ số Purchasing Managers’ Index (PMI) là một công cụ quan trọng để đo lường hoạt động kinh tế trong ngành sản xuất. Chỉ số PMI cung cấp thông tin về sự mở rộng hay suy thoái của một nền kinh tế dựa trên các yếu tố như sản lượng, đơn hàng mới, việc tuyển […]