PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / classes / download.php
wp-all-export / classes Last commit date
partner-discount-sdk 3 weeks ago CdataStrategy.php 3 weeks ago CdataStrategyAlways.php 3 weeks ago CdataStrategyFactory.php 3 weeks ago CdataStrategyIllegalCharacters.php 3 weeks ago CdataStrategyIllegalCharactersHtmlEntities.php 3 weeks ago CdataStrategyNever.php 3 weeks ago XMLWriter.php 3 weeks ago chunk.php 3 weeks ago config.php 3 years ago download.php 3 weeks ago handler.php 3 weeks ago helper.php 3 weeks ago input.php 3 weeks ago installer.php 3 weeks ago session.php 10 years ago wpallimport.php 3 weeks ago zip.php 4 years ago
download.php
59 lines
1 <?php
2
3 class PMXE_Download
4 {
5
6 static public function zip($file_name)
7 {
8 $uploads = wp_upload_dir();
9 $bundle_url = $uploads['baseurl'] . str_replace($uploads['basedir'], '', $file_name);
10 $bundle_url = str_replace( "\\", "/", $bundle_url );
11 wp_safe_redirect($bundle_url);
12 die;
13 }
14
15 static public function xls($file_name)
16 {
17 self::sendFile("Content-Type: application/vnd.ms-excel; charset=UTF-8", $file_name);
18 }
19
20 static public function xlsx($file_name)
21 {
22 self::sendFile("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8", $file_name);
23 }
24
25 static public function csv($file_name)
26 {
27 self::sendFile("Content-Type: text/plain; charset=UTF-8", $file_name);
28 }
29
30 static public function txt($file_name)
31 {
32 self::sendFile("Content-Type: text/plain; charset=UTF-8", $file_name);
33 }
34
35 static public function xml($file_name)
36 {
37 self::sendFile("Content-Type: application/xhtml+xml; charset=UTF-8", $file_name);
38 }
39
40 static public function sendFile($header, $file_name)
41 {
42 // If we ar testing don't sent it as attachment
43 if (php_sapi_name() != 'cli-server') {
44 header($header);
45 header("Content-Disposition: attachment; filename=\"" . basename($file_name) . "\"");
46 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
47 header("Cache-Control: post-check=0, pre-check=0", false);
48 header("Pragma: no-cache");
49 }
50 while (ob_get_level()) {
51 ob_end_clean();
52 }
53
54 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- export plugin reads/writes its own files in uploads dir, WP_Filesystem not viable for streamed CSV/XML output
55 readfile($file_name);
56 die;
57 }
58
59 }