| @@ -107,10 +107,10 @@ | ||
| 107 | 107 | $template->fill(); |
| 108 | 108 | $request = $template->render(); |
| 109 | 109 | |
| 110 | 110 | if (!isset($request['error'])) { |
| 111 | - | |
| 112 | - $tmp_dir = $this->helper->get('tmp_dir') . 'e2pdf' . md5($entry->get('uid')) . '/'; | |
| 111 | + $attach = $attributes->get('attach') === 'always' ? '_' . bin2hex(random_bytes(8)) : ''; | |
| 112 | + $tmp_dir = $this->helper->get('tmp_dir') . 'e2pdf' . md5($entry->get('uid') . $attach) . '/'; | |
| 113 | 113 | $this->helper->create_dir($tmp_dir); |
| 114 | 114 | |
| 115 | 115 | $filename = $template->get('name') . '.' . $template->get('format'); |
| 116 | 116 | $filename = $this->helper->load('convert')->to_file_name($filename); |
| @@ -153,9 +153,9 @@ | ||
| 153 | 153 | */ |
| 154 | 154 | if (strpos($attributes->get('dataset'), 'post_data:ID') !== false) { |
| 155 | 155 | $response .= '[e2pdf-download '; |
| 156 | 156 | foreach ($atts as $key => $value) { |
| 157 | - $response .= $key . '="' . str_replace('"', '', $value) . '" '; | |
| 157 | + $response .= sanitize_key($key) . '="' . esc_attr($value) . '" '; | |
| 158 | 158 | } |
| 159 | 159 | $response .= ']'; |
| 160 | 160 | return $response; |
| 161 | 161 | } |
| @@ -276,14 +276,14 @@ | ||
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $lid = uniqid('', true); |
| 280 | - $response = '<a lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 280 | + $response = '<a data-lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 281 | 281 | if ($iframe_download) { |
| 282 | 282 | $url = add_query_arg(['v' => $this->helper->get('version')], $url); |
| 283 | 283 | |
| 284 | 284 | $src = $attributes->get('preload') ? 'preload' : 'src'; |
| 285 | - $preload_class = $attributes->get('preload') ? 'e2pdf-preload' : ''; | |
| 285 | + $preload_class = $attributes->get('preload') ? 'e2pdf-preload e2pdf-js-preload' : 'e2pdf-js-preload'; | |
| 286 | 286 | |
| 287 | 287 | if ($inline || (get_option('e2pdf_download_loader', '0') == '1' && $this->helper->load('server')->isLoaderSupported())) { |
| 288 | 288 | $response .= '<img class="' . esc_attr($preload_class) . '" onload="e2pdfViewer.autoDownload(\'' . esc_attr($lid) . '\');" style="display:none" ' . $src . '="' . $attributes->get('iframe_loader') . '">'; |
| 289 | 289 | } else { |
| @@ -360,14 +360,14 @@ | ||
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $lid = uniqid('', true); |
| 364 | - $response = '<a lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 364 | + $response = '<a data-lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 365 | 365 | if ($iframe_download) { |
| 366 | 366 | $url = add_query_arg(['v' => $this->helper->get('version')], $url); |
| 367 | 367 | |
| 368 | 368 | $src = $attributes->get('preload') ? 'preload' : 'src'; |
| 369 | - $preload_class = $attributes->get('preload') ? 'e2pdf-preload' : ''; | |
| 369 | + $preload_class = $attributes->get('preload') ? 'e2pdf-preload e2pdf-js-preload' : 'e2pdf-js-preload'; | |
| 370 | 370 | |
| 371 | 371 | if ($inline || (get_option('e2pdf_download_loader', '0') == '1' && $this->helper->load('server')->isLoaderSupported())) { |
| 372 | 372 | $response .= '<img class="' . esc_attr($preload_class) . '" onload="e2pdfViewer.autoDownload(\'' . esc_attr($lid) . '\');" style="display:none" ' . $src . '="' . $attributes->get('iframe_loader') . '">'; |
| 373 | 373 | } else { |
| @@ -530,14 +530,14 @@ | ||
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | $lid = uniqid('', true); |
| 534 | - $response = '<a lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 534 | + $response = '<a data-lid="' . esc_attr($lid) . '" rel="nofollow" ' . $file_download . ' id="e2pdf-download" class="' . esc_attr(implode(' ', $classes)) . '" style="' . esc_attr(implode(';', $attributes->get('style'))) . '" target="' . esc_attr($target) . '" href="' . esc_url($url) . '">' . $button_title . '</a>'; | |
| 535 | 535 | if ($iframe_download) { |
| 536 | 536 | $url = add_query_arg(['v' => $this->helper->get('version')], $url); |
| 537 | 537 | |
| 538 | 538 | $src = $attributes->get('preload') ? 'preload' : 'src'; |
| 539 | - $preload_class = $attributes->get('preload') ? 'e2pdf-preload' : ''; | |
| 539 | + $preload_class = $attributes->get('preload') ? 'e2pdf-preload e2pdf-js-preload' : 'e2pdf-js-preload'; | |
| 540 | 540 | |
| 541 | 541 | if ($template->get('inline') || (get_option('e2pdf_download_loader', '0') == '1' && $this->helper->load('server')->isLoaderSupported())) { |
| 542 | 542 | $response .= '<img class="' . esc_attr($preload_class) . '" onload="e2pdfViewer.autoDownload(\'' . esc_attr($lid) . '\');" style="display:none" ' . $src . '="' . $attributes->get('iframe_loader') . '">'; |
| 543 | 543 | } else { |
| @@ -1422,8 +1422,9 @@ | ||
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | $classes = $attributes->get('class'); |
| 1425 | 1425 | $classes[] = 'e2pdf-view'; |
| 1426 | + $classes[] = 'e2pdf-js-preload'; | |
| 1426 | 1427 | |
| 1427 | 1428 | if ($attributes->get('preload')) { |
| 1428 | 1429 | $classes[] = 'e2pdf-preload'; |
| 1429 | 1430 | } |