| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* E2pdf WPBakery Page Builder Helper |
| 5 |
* @copyright Copyright 2017 https://e2pdf.com |
| 6 |
* @license GPLv3 |
| 7 |
* @version 1 |
| 8 |
* @link https://e2pdf.com |
| 9 |
* @since 1.22.00 |
| 10 |
*/ |
| 11 |
if (!defined('ABSPATH')) { |
| 12 |
die('Access denied.'); |
| 13 |
} |
| 14 |
|
| 15 |
class Helper_E2pdf_Vc { |
| 16 |
|
| 17 |
private $helper; |
| 18 |
|
| 19 |
public function __construct() { |
| 20 |
$this->helper = Helper_E2pdf_Helper::instance(); |
| 21 |
} |
| 22 |
|
| 23 |
public function params($type = 'e2pdf-download') { |
| 24 |
global $wpdb; |
| 25 |
|
| 26 |
$templates = $wpdb->get_results($wpdb->prepare('SELECT `ID`, `title` FROM `' . $wpdb->prefix . 'e2pdf_templates' . '` WHERE extension = %s OR extension = %s', 'wordpress', 'woocommerce'), ARRAY_A); |
| 27 |
|
| 28 |
$params = array( |
| 29 |
array( |
| 30 |
'type' => 'dropdown', |
| 31 |
'heading' => esc_html__('Template ID', 'e2pdf'), |
| 32 |
'param_name' => 'id', |
| 33 |
'group' => esc_html__('General', 'e2pdf'), |
| 34 |
'value' => array_map( |
| 35 |
function ($val) { |
| 36 |
return array( |
| 37 |
'value' => $val['ID'], |
| 38 |
'label' => $val['ID'] . ': ' . esc_html($val['title']) |
| 39 |
); |
| 40 |
}, |
| 41 |
$templates |
| 42 |
), |
| 43 |
), |
| 44 |
array( |
| 45 |
'type' => 'textfield', |
| 46 |
'heading' => esc_html__('Class', 'e2pdf'), |
| 47 |
'param_name' => 'class', |
| 48 |
'group' => esc_html__('Style', 'e2pdf'), |
| 49 |
'value' => '', |
| 50 |
), |
| 51 |
array( |
| 52 |
'type' => 'textfield', |
| 53 |
'heading' => esc_html__('PDF Name', 'e2pdf'), |
| 54 |
'param_name' => 'name', |
| 55 |
'group' => esc_html__('Pdf', 'e2pdf'), |
| 56 |
'value' => '', |
| 57 |
), |
| 58 |
array( |
| 59 |
'type' => 'textfield', |
| 60 |
'heading' => esc_html__('PDF Open Password', 'e2pdf'), |
| 61 |
'param_name' => 'password', |
| 62 |
'group' => esc_html__('Pdf', 'e2pdf'), |
| 63 |
'value' => '', |
| 64 |
), |
| 65 |
array( |
| 66 |
'type' => 'dropdown', |
| 67 |
'heading' => esc_html__('PDF Flatten', 'e2pdf'), |
| 68 |
'param_name' => 'flatten', |
| 69 |
'group' => esc_html__('Pdf', 'e2pdf'), |
| 70 |
'value' => array( |
| 71 |
array( |
| 72 |
'value' => '', |
| 73 |
'label' => esc_html__('Default', 'e2pdf'), |
| 74 |
), |
| 75 |
array( |
| 76 |
'value' => '0', |
| 77 |
'label' => esc_html__('No', 'e2pdf'), |
| 78 |
), |
| 79 |
array( |
| 80 |
'value' => '1', |
| 81 |
'label' => esc_html__('Yes', 'e2pdf'), |
| 82 |
), |
| 83 |
array( |
| 84 |
'value' => '2', |
| 85 |
'label' => esc_html__('Full', 'e2pdf'), |
| 86 |
), |
| 87 |
) |
| 88 |
), |
| 89 |
array( |
| 90 |
'type' => 'dropdown', |
| 91 |
'heading' => esc_html__('Format', 'e2pdf'), |
| 92 |
'param_name' => 'format', |
| 93 |
'group' => esc_html__('Pdf', 'e2pdf'), |
| 94 |
'value' => array( |
| 95 |
array( |
| 96 |
'value' => '', |
| 97 |
'label' => esc_html__('Default', 'e2pdf'), |
| 98 |
), |
| 99 |
array( |
| 100 |
'value' => 'pdf', |
| 101 |
'label' => esc_html__('pdf', 'e2pdf'), |
| 102 |
), |
| 103 |
array( |
| 104 |
'value' => 'jpg', |
| 105 |
'label' => esc_html__('jpg', 'e2pdf'), |
| 106 |
), |
| 107 |
) |
| 108 |
), |
| 109 |
array( |
| 110 |
'type' => 'dropdown', |
| 111 |
'heading' => esc_html__('PDF Inline', 'e2pdf'), |
| 112 |
'param_name' => 'inline', |
| 113 |
'group' => esc_html__('Pdf', 'e2pdf'), |
| 114 |
'value' => array( |
| 115 |
array( |
| 116 |
'value' => '', |
| 117 |
'label' => esc_html__('Default', 'e2pdf'), |
| 118 |
), |
| 119 |
array( |
| 120 |
'value' => 'true', |
| 121 |
'label' => esc_html__('Yes', 'e2pdf'), |
| 122 |
), |
| 123 |
array( |
| 124 |
'value' => 'false', |
| 125 |
'label' => esc_html__('No', 'e2pdf'), |
| 126 |
), |
| 127 |
) |
| 128 |
), |
| 129 |
); |
| 130 |
|
| 131 |
if ($type == 'e2pdf-download') { |
| 132 |
$params[] = array( |
| 133 |
'type' => 'textfield', |
| 134 |
'heading' => esc_html__('Button Title', 'e2pdf'), |
| 135 |
'param_name' => 'button_title', |
| 136 |
'group' => esc_html__('Style', 'e2pdf'), |
| 137 |
'value' => '', |
| 138 |
); |
| 139 |
} |
| 140 |
|
| 141 |
if ($type == 'e2pdf-view') { |
| 142 |
$params[] = array( |
| 143 |
'type' => 'dropdown', |
| 144 |
'heading' => esc_html__('Zoom', 'e2pdf'), |
| 145 |
'param_name' => 'zoom', |
| 146 |
'group' => esc_html__('Style', 'e2pdf'), |
| 147 |
'value' => array( |
| 148 |
array( |
| 149 |
'value' => '', |
| 150 |
'label' => esc_html__('Default', 'e2pdf'), |
| 151 |
), |
| 152 |
array( |
| 153 |
'value' => 'page-width', |
| 154 |
'label' => 'page-width', |
| 155 |
), |
| 156 |
array( |
| 157 |
'value' => 'page-height', |
| 158 |
'label' => 'page-height', |
| 159 |
), |
| 160 |
array( |
| 161 |
'value' => 'page-fit', |
| 162 |
'label' => 'page-fit', |
| 163 |
), |
| 164 |
array( |
| 165 |
'value' => 'auto', |
| 166 |
'label' => 'auto', |
| 167 |
), |
| 168 |
) |
| 169 |
); |
| 170 |
|
| 171 |
$params[] = array( |
| 172 |
'type' => 'dropdown', |
| 173 |
'heading' => esc_html__('Responsive', 'e2pdf'), |
| 174 |
'param_name' => 'responsive', |
| 175 |
'group' => esc_html__('Style', 'e2pdf'), |
| 176 |
'value' => array( |
| 177 |
array( |
| 178 |
'value' => '', |
| 179 |
'label' => esc_html__('Default', 'e2pdf'), |
| 180 |
), |
| 181 |
array( |
| 182 |
'value' => 'true', |
| 183 |
'label' => 'true', |
| 184 |
), |
| 185 |
array( |
| 186 |
'value' => 'page', |
| 187 |
'label' => 'page', |
| 188 |
), |
| 189 |
) |
| 190 |
); |
| 191 |
} |
| 192 |
|
| 193 |
return $params; |
| 194 |
} |
| 195 |
} |
| 196 |
|