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

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

Rút tiền thẻ tín dụng là gì? Ưu nhược điểm và phí rút tiền mặt

Bạn đã từng nghe về việc rút tiền mặt từ thẻ tín dụng, nhưng chưa hiểu rõ về nó? Bài viết này sẽ giúp bạn tìm hiểu chi tiết hơn về khái niệm rút tiền thẻ tín dụng, cũng như ưu nhược điểm và các khoản phí liên quan đến hoạt động này. Thẻ tín […]

Lạm phát là gì? Phân loại, nguyên nhân và giải pháp kiểm soát

Lạm phát là một trong những khái niệm kinh tế quan trọng, ảnh hưởng đến cuộc sống của nhiều người. Trong bài viết này, chúng ta sẽ tìm hiểu về lạm phát, từ định nghĩa cơ bản đến các nguyên nhân, phân loại và giải pháp kiểm soát. Lạm phát và giảm phát là gì? […]

Công ty TNHH là gì? Đặc điểm, ưu nhược điểm và phân loại

Công ty trách nhiệm hữu hạn (CTTNHH) là một hình thức doanh nghiệp được pháp luật công nhận. Như tên gọi, đây là một công ty có trách nhiệm với các khoản nợ và các hoạt động kinh doanh chỉ trong giới hạn của số vốn điều lệ mà công ty đã đăng ký khi […]

Các kích thước phổ biến, lưu ý khí sử dụng

Chiếu trúc là một sản phẩm từ thiên nhiên, được làm từ tre hoặc trúc. Với tính chất mát mẻ, thoáng khí, chiếu trúc mang lại cảm giác dễ chịu, thoải mái cho người nằm trên đó. Bài viết này sẽ cung cấp cho bạn kiến thức về giá, loại và kích thước của chiếu […]

Tiền thực tế khi rút tiền bảo hiểm xã hội một lần là bao nhiêu?

Bảo hiểm xã hội một lần là khoản tiền mà người tham gia bảo hiểm xã hội được nhận khi đã đóng bảo hiểm xã hội đủ 12 tháng trở lên nhưng chưa đủ điều kiện hưởng lương hưu, trợ cấp mất sức lao động, trợ cấp hằng tháng. Giá trị thực tế khi rút […]

CIC là gì? Điểm CIC là gì?Ý nghĩa của CIC?

CIC là viết tắt của Trung tâm Thông tin Tín dụng – Credit Information Center. Đây là một tổ chức được thành lập bởi Ngân hàng Nhà nước Việt Nam vào năm 2008 với nhiệm vụ thu thập, lưu trữ, phân tích và xử lý thông tin tín dụng của cá nhân và tổ chức. […]

Hatha yoga là gì? Lợi ích của hatha yoga

  Hatha yoga là gì? Hatha yoga là một hình thức tập thể dục kết hợp giữa các động tác yoga và nhịp thở. Đây là một hình thức phổ biến của yoga tại Ấn Độ, được tập trung vào việc cân bằng cả hai yếu tố về thể chất và tinh thần. Các động […]

Công ty cổ phần là gì? Đặc điểm,điều lệ, ưu nhược điểm

Công ty cổ phần (CTCP) là một loại hình doanh nghiệp được thành lập dựa trên nguyên tắc phân chia vốn và quản lý công ty bởi các cổ đông. CTCP thường được thành lập để phát triển kinh doanh lớn hơn và thu hút vốn đầu tư từ nhiều nguồn khác nhau. Trong bài […]

6 lỗi máy giặt cơ bản có thể tự sửa tại nhà

Máy giặt là một trong những thiết bị gia dụng quan trọng trong cuộc sống hiện đại. Tuy nhiên, đôi khi máy giặt của bạn có thể gặp phải các lỗi cơ bản. Đừng lo lắng, hầu hết các lỗi này bạn có thể tự sửa tại nhà với vài bước đơn giản. 1. Máy […]

Thẻ tín dụng là gì? Những lưu ý khi sử dụng

Nếu bạn đang có kế hoạch mở thẻ tín dụng hoặc đang quan tâm đến việc sử dụng thẻ tín dụng thì bài viết này sẽ giúp bạn hiểu rõ hơn về thẻ tín dụng, các loại thẻ tín dụng, hạn mức thẻ tín dụng, lợi ích khi sử dụng thẻ tín dụng, những trường […]