PluginProbe
PDF for WPForms + Drag and Drop Template Builder / trunk
PDF for WPForms + Drag and Drop Template Builder vtrunk
7.2.0 7.1.0 trunk 2.5.0 3.0.0 6.2.1 6.3.1 6.5.0 6.5.1 6.5.2
pdf-for-wpforms / preview.php

preview.php in PDF for WPForms + Drag and Drop Template Builder trunk, at preview.php

40 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 if( isset($_GET['id'])) {
4 $id_template = sanitize_text_field( $_GET['id'] );
5 $type = "preview";
6 if( isset($_GET["download"]) ){
7 $type = "download";
8 }
9 if( isset($_GET["html"]) ){
10 $type = "html";
11 }
12 $name ="pdf_name";
13 if( isset($_GET["pdf_name"]) ){
14 $name = sanitize_text_field($_GET["pdf_name"]);
15 $name = urldecode($name);
16 $name = sanitize_file_name($name);
17 }
18 $user = wp_get_current_user();
19 $allowed_roles = array('editor', 'administrator', 'author',"shop_manager");
20 $check = false;
21 if ( isset( $_REQUEST['_wpnonce']) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'yeepdf' ) ) {
22 $check = true;
23 }
24 if( array_intersect($allowed_roles, $user->roles ) ) {
25 $check = true;
26 }
27 if( $check ){
28 $order_id = "";
29 if( isset($_GET["woo_order"]) ) {
30 $order_id = sanitize_text_field( $_GET['woo_order'] );
31 }
32 $data_send_settings = array(
33 "id_template"=> $id_template,
34 "type"=> $type,
35 "woo_order_id" =>$order_id,
36 "name" => $name
37 );
38 Yeepdf_Create_PDF::pdf_creator_preview($data_send_settings);
39 }
40 }