| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | * |
| 22 | 22 | * @author ThimPress |
| 23 | 23 | * @package LearnPress\Ajax |
| 24 | 24 | * @since 4.3.2.8 |
| 25 | - * @version 1.0.0 | |
| 25 | + * @version 1.0.1 | |
| 26 | 26 | */ |
| 27 | 27 | class ExportOrderCSVAjax extends AbstractAjax { |
| 28 | 28 | /** |
| 29 | 29 | * Export orders to CSV file, action call from js file: export-order.js |
| @@ -138,8 +138,10 @@ | ||
| 138 | 138 | * |
| 139 | 139 | * @param string $export_id |
| 140 | 140 | * |
| 141 | 141 | * @return string |
| 142 | + * @since 4.3.2.8 | |
| 143 | + * @version 1.0.0 | |
| 142 | 144 | */ |
| 143 | 145 | public static function get_export_csv_path( string $export_id = '' ): string { |
| 144 | 146 | $upload = wp_upload_dir(); |
| 145 | 147 | $dir = $upload['basedir'] . '/lp-order-export'; |
| @@ -145,8 +147,13 @@ | ||
| 145 | 147 | $dir = $upload['basedir'] . '/lp-order-export'; |
| 146 | 148 | |
| 147 | 149 | if ( ! file_exists( $dir ) ) { |
| 148 | 150 | wp_mkdir_p( $dir ); |
| 151 | + } | |
| 152 | + | |
| 153 | + $index_file = $dir . '/index.php'; | |
| 154 | + if ( ! file_exists( $index_file ) ) { | |
| 155 | + file_put_contents( $index_file, "<?php\n// Silence is golden.\n" ); | |
| 149 | 156 | } |
| 150 | 157 | |
| 151 | 158 | return $dir . "/lp-orders-{$export_id}.csv"; |
| 152 | 159 | } |