private function download_report($dest_filename) { if (!is_string($dest_filename)) { return new WP_Error('invalid-argument', 'The download-report function takes a string representing an individual report.'); } $report_url = 'https://s3.amazonaws.com/sync-reports.ithemes.com/' . $dest_filename; $upload_path = Ithemes_Sync_Functions::get_upload_reports_dir(); if (wp_is_writable($upload_path)) { if (!file_exists($upload_path . '/index.php')) { @file_put_contents($upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.'); } $contents = @file_get_contents($report_url); @file_put_contents($upload_path . '/' . $dest_filename, $contents); $result = Ithemes_Sync_Functions::get_upload_reports_url() . '/' . $dest_filename; } else { $result = false; } return $result; }