@ 2017-07-11T14:44:58Z <?php
//php
AjaxHelper::add_action('resume_download', function () {
AjaxHelper::verify_nonce();
$resumes_string = isset($_POST['resumes']) ? trim($_POST['resumes']) : '';
$resumes = explode(',', $resumes_string);
$files = [];
if (count($resumes) > 0) {
foreach ($resumes as $resume) {
$resume_file_id = get_post_meta( $resume, 'resume_file', true );
if (!empty($resume_file_id)) {
$files[] = get_attached_file($resume_file_id);
}
}
}
header('Pragma: public');
header('Accept-Ranges: bytes');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Disposition: attachment; filename="archive.zip"');
header('Content-Type: application/octet-stream');
$fp = popen('zip -j -q -r - ' . implode(' ', array_map('escapeshellarg', $files)), 'r');
$bufsize = 8192;
$buff = '';
while (!feof($fp)) {
echo fread($fp, $bufsize);
}
pclose($fp);
exit();
});
//html
<form id="download_form" method="post" action="<?= admin_url('admin-ajax.php') ?>" class="selected-action">
<input type="hidden" name="<?= THEME_NONCE_NAME ?>" value="<?= wp_create_nonce(THEME_NONCE_ACTION) ?>">
<input type="hidden" name="action" value="resume_download" />
<input type="hidden" name="resumes" value="" />
<button class="downloads"><?php _e('Download my selection of CV', 'hec'); ?></button>
</form>
//js
$(".downloads").click(function () {
var resumes = [],
table = $('table > tbody > tr');
table.each(function () {
var resume_id = $(this).attr('data-id');
if ($(this).hasClass('selected')) {
resumes.push(resume_id);
}
});
var string_resumes = resumes.toString();
$("input[name='resumes']").val(string_resumes);
$('#download_form').submit();
});
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.1.7 0.000 0.017 17.13 7.1.6 0.026 0.016 35.09 7.1.5 0.019 0.022 34.73 7.1.4 0.026 0.016 34.26 7.1.3 0.033 0.011 34.32 7.1.2 0.030 0.017 34.19 7.1.1 0.013 0.006 16.40 7.1.0 0.010 0.010 16.63 7.0.20 0.004 0.014 16.67 7.0.19 0.005 0.014 16.49 7.0.18 0.003 0.016 16.00 7.0.17 0.007 0.015 16.11 7.0.16 0.012 0.006 16.09 7.0.15 0.011 0.007 16.24 7.0.14 0.006 0.013 16.08 7.0.13 0.013 0.007 16.53 7.0.12 0.008 0.011 16.36 7.0.11 0.010 0.010 16.20 7.0.10 0.004 0.017 16.16 7.0.9 0.005 0.016 16.15 7.0.8 0.008 0.013 16.20 7.0.7 0.005 0.017 16.00 7.0.6 0.008 0.010 15.72 7.0.5 0.009 0.014 16.14 7.0.4 0.005 0.017 16.33 7.0.3 0.007 0.018 16.45 7.0.2 0.009 0.012 16.31 7.0.1 0.008 0.012 16.20 7.0.0 0.007 0.013 16.16
preferences:dark mode live preview
139.67 ms | 1394 KiB | 7 Q