PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.02.02
E2Pdf – Export Pdf Tool for WordPress v1.02.02
1.32.49 1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 1.08.06 All 72 releases
e2pdf / classes / extension / e2pdf-wordpress.php

e2pdf-wordpress.php in E2Pdf – Export Pdf Tool for WordPress 1.02.02, at classes/extension/e2pdf-wordpress.php

708 lines 24.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * E2pdf Wordpress Extension
5 *
6 * @copyright Copyright 2017 https://e2pdf.com
7 * @license GPL v2
8 * @version 1
9 * @link https://e2pdf.com
10 * @since 0.00.01
11 */
12 if (!defined('ABSPATH')) {
13 die('Access denied.');
14 }
15
16 class Extension_E2pdf_Wordpress extends Model_E2pdf_Model {
17
18 private $options;
19
20 function __construct() {
21 parent::__construct();
22 }
23
24 /**
25 * Get info about extension
26 *
27 * @return array() - Extension key and name
28 */
29 public function info() {
30 return array(
31 'wordpress' => __('Wordpress', 'e2pdf')
32 );
33 }
34
35 /**
36 * Check if needed plugin active
37 *
38 * @return bool - Activated/Not Activated plugin
39 */
40 public function active() {
41 return true;
42 }
43
44 /**
45 * Check if export item function available
46 *
47 * @return bool - Item export available/not available
48 */
49 public function export() {
50 return false;
51 }
52
53 /**
54 * Set option
55 *
56 * @param string $attr - Key of option
57 * @param string $value - Value of option
58 *
59 * @return bool - Status of setting option
60 */
61 public function set($key, $value) {
62 if (!isset($this->options)) {
63 $this->options = new stdClass();
64 }
65
66 $this->options->$key = $value;
67 }
68
69 /**
70 * Get option by key
71 *
72 * @param string $key - Key to get assigned option value
73 *
74 * @return mixed
75 */
76 public function get($key) {
77 if (isset($this->options->$key)) {
78 $value = $this->options->$key;
79 return $value;
80 } else {
81 return false;
82 }
83 }
84
85 /**
86 * Get items to work with
87 *
88 * @return array() - List of available items
89 */
90 public function get_items() {
91 $content = array();
92
93 $content[] = array(
94 'key' => 'post',
95 'value' => __('Wordpress Posts', 'e2pdf'),
96 );
97 $content[] = array(
98 'key' => 'page',
99 'value' => __('Wordpress Pages', 'e2pdf'),
100 );
101
102 return $content;
103 }
104
105 /**
106 * Get entries for export
107 *
108 * @param string $item - Item
109 * @param string $name - Entries names
110 *
111 * @return array() - Entries list
112 */
113 public function get_datasets($item = false, $name = false) {
114
115 $datasets = array();
116
117 if ($item) {
118 if ($item == 'page') {
119 $datasets_tmp = get_pages();
120 } elseif ($item == 'post') {
121 $datasets_tmp = get_posts();
122 }
123
124 if ($datasets_tmp) {
125 foreach ($datasets_tmp as $key => $dataset) {
126 $this->set('item', $item);
127 $this->set('dataset', $dataset->ID);
128 $dataset_title = $this->render($name);
129 if (!$dataset_title) {
130 $dataset_title = $dataset->post_title;
131 }
132 $datasets[] = array(
133 'key' => $dataset->ID,
134 'value' => $dataset_title
135 );
136 }
137 }
138 }
139
140 return $datasets;
141 }
142
143 /**
144 * Get dataset
145 *
146 * @param int $dataset - Dataset ID
147 *
148 * @return object - Dataset
149 */
150 public function get_dataset($dataset = false) {
151
152 $dataset = (int) $dataset;
153
154 if (!$dataset) {
155 return;
156 }
157
158 $data = new stdClass();
159 $data->url = $this->helper->get_url(array('post' => $dataset, 'action' => 'edit'), 'post.php?');
160
161 return $data;
162 }
163
164 /**
165 * Get item
166 *
167 * @param string $item - Item
168 *
169 * @return object - Item
170 */
171 public function get_item($item = false) {
172
173 $form = new stdClass();
174 if ($item == 'post') {
175 $form->name = __('Wordpress Posts', 'e2pdf');
176 $form->url = $this->helper->get_url(array('post_type' => $item), 'edit.php?');
177 } elseif ($item == 'page') {
178 $form->name = __('Wordpress Pages', 'e2pdf');
179 $form->url = $this->helper->get_url(array('post_type' => $item), 'edit.php?');
180 } else {
181 $form->name = '';
182 $form->url = 'javascript:void(0);';
183 }
184
185 return $form;
186 }
187
188 public function load_filters() {
189 add_filter('the_content', array($this, 'filter_content'), 10, 2);
190 }
191
192 /**
193 * Render value according to content
194 *
195 * @param string $value - Content
196 * @param string $type - Type of rendering value
197 * @param array $field - Field details
198 *
199 * @return string - Fully rendered value
200 */
201 public function render($value, $type = false, $field = array()) {
202
203 $value = $this->render_shortcodes($value, $type, $field);
204 $value = $this->strip_shortcodes($value);
205
206 if ($type === 'value' && isset($field['type']) && $field['type'] === 'e2pdf-checkbox' && isset($field['properties']['option'])) {
207 $option = $this->render($field['properties']['option']);
208 $options = explode(', ', $value);
209 $option_options = explode(', ', $option);
210 if (is_array($options) && is_array($option_options) && !array_diff($option_options, $options)) {
211 return $option;
212 } else {
213 return "";
214 }
215 }
216
217 if ($type === 'value') {
218 $value = str_replace("&#91;", "[", $value);
219 }
220
221 return $value;
222 }
223
224 /**
225 * Render shortcodes which available in this extension
226 *
227 * @param string $value - Content
228 * @param string $type - Type of rendering value
229 * @param array $field - Field details
230 *
231 * @return string - Value with rendered shortcodes
232 */
233 public function render_shortcodes($value, $type = false, $field = array()) {
234
235 $dataset_id = $this->get('dataset');
236 $item_id = $this->get('item');
237 $post = get_post($dataset_id);
238
239 $ext_shortcodes = array(
240 "[id]" => $post->ID,
241 "[post_author]" => get_userdata($post->post_author)->user_nicename,
242 "[post_date]" => $post->post_date,
243 "[post_date_gmt]" => $post->post_date_gmt,
244 "[post_content]" => $post->post_content,
245 "[post_title]" => $post->post_title,
246 "[post_excerpt]" => $post->post_excerpt,
247 "[post_status]" => $post->post_status,
248 "[comment_status]" => $post->comment_status,
249 "[ping_status]" => $post->ping_status,
250 "[post_password]" => $post->post_password,
251 "[post_name]" => $post->post_name,
252 "[to_ping]" => $post->to_ping,
253 "[pinged]" => $post->pinged,
254 "[post_modified]" => $post->post_modified,
255 "[post_modified_gmt]" => $post->post_modified_gmt,
256 "[post_content_filtered]" => $post->post_content_filtered,
257 "[post_parent]" => $post->post_parent,
258 "[guid]" => $post->guid,
259 "[menu_order]" => $post->menu_order,
260 "[post_type]" => $post->post_type,
261 "[post_mime_type]" => $post->post_mime_type,
262 "[comment_count]" => $post->comment_count,
263 "[filter]" => $post->filter
264 );
265
266
267 $post_content = false;
268
269 if (false !== strpos($value, '[')) {
270
271 $shortcode_tags = array(
272 'meta',
273 );
274 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $value, $matches);
275 $tagnames = array_intersect($shortcode_tags, $matches[1]);
276
277 if (!empty($tagnames)) {
278 $pattern = get_shortcode_regex($tagnames);
279
280 preg_match_all("/$pattern/", $value, $shortcodes);
281
282 foreach ($shortcodes[0] as $key => $shortcode_value) {
283 $shortcode = array();
284 $shortcode[1] = $shortcodes[1][$key];
285 $shortcode[2] = $shortcodes[2][$key];
286 $shortcode[3] = $shortcodes[3][$key];
287 $shortcode[4] = $shortcodes[4][$key];
288 $shortcode[5] = $shortcodes[5][$key];
289 $shortcode[6] = $shortcodes[6][$key];
290
291 $atts = shortcode_parse_atts($shortcode[3]);
292
293 if (array_key_exists('key', $atts)) {
294 $value = str_replace($shortcode_value, get_post_meta($post->ID, $atts['key'], true), $value);
295 }
296 }
297 }
298
299
300 $shortcode_tags = array(
301 'e2pdf-format-number',
302 'e2pdf-format-date',
303 'e2pdf-format-output',
304 );
305 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $value, $matches);
306 $tagnames = array_intersect($shortcode_tags, $matches[1]);
307
308 if (!empty($tagnames)) {
309
310 $pattern = get_shortcode_regex($tagnames);
311 preg_match_all("/$pattern/", $value, $shortcodes);
312 foreach ($shortcodes[0] as $key => $shortcode_value) {
313 $shortcode = array();
314 $shortcode[1] = $shortcodes[1][$key];
315 $shortcode[2] = $shortcodes[2][$key];
316 $shortcode[3] = $shortcodes[3][$key];
317 $shortcode[4] = $shortcodes[4][$key];
318 $shortcode[5] = $shortcodes[5][$key];
319 $shortcode[6] = $shortcodes[6][$key];
320
321 if (isset($shortcode['5'])) {
322
323 if (strpos($shortcode['5'], "[post_content]") !== FALSE && !$this->get('no_filter') && !$post_content) {
324 $ext_shortcodes['[post_content]'] = $this->before_render_post_content($ext_shortcodes['[post_content]']);
325 $ext_shortcodes['[post_content]'] = apply_filters('the_content', $ext_shortcodes['[post_content]']);
326 $ext_shortcodes['[post_content]'] = str_replace("</p>", "</p>&nbsp;\r\n", $ext_shortcodes['[post_content]']);
327 $post_content = true;
328 }
329
330 $sub_value = str_replace(array_keys($ext_shortcodes), $ext_shortcodes, $shortcode['5']);
331 $value = str_replace($shortcode_value, "[" . $shortcode['2'] . $shortcode['3'] . "]" . $sub_value . "[/" . $shortcode['2'] . "]", $value);
332 }
333 }
334 }
335 }
336
337 $value = do_shortcode($value);
338
339 if (isset($field['type']) && ($field['type'] === 'e2pdf-image' || $field['type'] === 'e2pdf-signature')) {
340 $esig = isset($field['properties']['esig']) && $field['properties']['esig'] ? true : false;
341 if ($esig) {
342 //process e-signature
343 $value = "";
344 } else {
345 if (!$this->helper->load('image')->get_image($value)) {
346 $value = $this->strip_shortcodes($value);
347 if (
348 $value &&
349 trim($value) != "" &&
350 extension_loaded('gd') &&
351 function_exists('imagettftext')
352 ) {
353 if (isset($field['properties']['text_color']) && $field['properties']['text_color']) {
354 $penColour = $this->helper->load('convert')->to_hex_color($field['properties']['text_color']);
355 } else {
356 $penColour = array(0x14, 0x53, 0x94);
357 }
358
359 $default_options = array(
360 'imageSize' => array(isset($field['width']) ? $field['width'] : '400', isset($field['height']) ? $field['height'] : '150'),
361 'bgColour' => 'transparent',
362 'penColour' => $penColour
363 );
364
365 $options = array();
366 $options = array_merge($default_options, $options);
367
368 $model_e2pdf_font = new Model_E2pdf_Font();
369
370 $font = false;
371 if (isset($field['properties']['text_font']) && $field['properties']['text_font']) {
372 $font = $model_e2pdf_font->get_font_path($field['properties']['text_font']);
373 }
374 if (!$font) {
375 $font = $model_e2pdf_font->get_font_path('Noto Sans');
376 }
377
378 $size = 150;
379 if (isset($field['properties']['text_font_size']) && $field['properties']['text_font_size']) {
380 $size = $field['properties']['text_font_size'];
381 }
382
383 $model_e2pdf_signature = new Model_E2pdf_Signature();
384 $value = $model_e2pdf_signature->ttf_signature($value, $size, $font, $options);
385 } else {
386 $value = "";
387 }
388 }
389 }
390 } else {
391 if (strpos($value, "[post_content]") !== FALSE && !$this->get('no_filter') && !$post_content) {
392 $ext_shortcodes['[post_content]'] = $this->before_render_post_content($ext_shortcodes['[post_content]']);
393 $ext_shortcodes['[post_content]'] = apply_filters('the_content', $ext_shortcodes['[post_content]']);
394 $ext_shortcodes['[post_content]'] = str_replace("</p>", "</p>&nbsp;\r\n", $ext_shortcodes['[post_content]']);
395 $post_content = true;
396 }
397 $value = str_replace(array_keys($ext_shortcodes), $ext_shortcodes, $value);
398 $value = str_replace("[", '&#91;', $value);
399 }
400
401
402 return $value;
403 }
404
405 public function filter_custom_shortcodes() {
406
407 }
408
409 /**
410 * Strip unused shortcodes
411 *
412 * @param string $value - Content
413 *
414 * @return string - Value with removed unused shortcodes
415 */
416 public function strip_shortcodes($value) {
417 $value = preg_replace('~(?:\[/?)[^/\]]+/?\]~s', "", $value);
418 return $value;
419 }
420
421 public function auto() {
422 $response = array();
423 $elements = array();
424
425
426 $post = $this->get('item');
427
428 $elements[] = array(
429 'type' => 'e2pdf-html',
430 'top' => '20',
431 'left' => '20',
432 'right' => '20',
433 'block' => true,
434 'properties' => array(
435 'value' => "<h1>[post_title]</h1>",
436 )
437 );
438
439
440 $elements[] = array(
441 'type' => 'e2pdf-html',
442 'top' => '20',
443 'left' => '20',
444 'right' => '20',
445 'block' => true,
446 'properties' => array(
447 'value' => __("Post name", 'e2pdf') . ": [post_name]",
448 )
449 );
450
451 $elements[] = array(
452 'type' => 'e2pdf-html',
453 'top' => '20',
454 'left' => '20',
455 'right' => '20',
456 'block' => true,
457 'properties' => array(
458 'value' => __("Post type", 'e2pdf') . ": [post_type]",
459 )
460 );
461
462
463 $elements[] = array(
464 'type' => 'e2pdf-html',
465 'top' => '20',
466 'left' => '20',
467 'right' => '20',
468 'block' => true,
469 'properties' => array(
470 'value' => __("ID", 'e2pdf') . ": [id]",
471 )
472 );
473
474 $elements[] = array(
475 'type' => 'e2pdf-html',
476 'top' => '20',
477 'left' => '20',
478 'right' => '20',
479 'block' => true,
480 'properties' => array(
481 'value' => __("Author", 'e2pdf') . ": [post_author]",
482 )
483 );
484
485
486
487 $elements[] = array(
488 'type' => 'e2pdf-html',
489 'top' => '20',
490 'left' => '20',
491 'right' => '20',
492 'block' => true,
493 'properties' => array(
494 'value' => "[post_content]",
495 'dynamic_height' => '1',
496 'height' => '300',
497 )
498 );
499
500
501 $elements[] = array(
502 'type' => 'e2pdf-html',
503 'top' => '20',
504 'left' => '20',
505 'right' => '20',
506 'block' => true,
507 'properties' => array(
508 'value' => __("Created", 'e2pdf') . ": [post_date]",
509 )
510 );
511
512 $elements[] = array(
513 'type' => 'e2pdf-html',
514 'top' => '20',
515 'left' => '20',
516 'right' => '20',
517 'block' => true,
518 'properties' => array(
519 'value' => __("Modified", 'e2pdf') . ": [post_modified]",
520 )
521 );
522
523
524 $response['page'] = array(
525 'bottom' => '20',
526 'top' => '20',
527 );
528
529
530
531 $response['elements'] = $elements;
532 return $response;
533 }
534
535 /**
536 * Action before wordpress post/page render
537 * Force to apply e2pdf shortcodes
538 *
539 * @param string $content - Content
540 *
541 * @return string - Content with update shortcodes
542 */
543 public function before_render_post_content($content) {
544
545 if (false === strpos($content, '[')) {
546 return $content;
547 }
548
549
550 $shortcode_tags = array(
551 'e2pdf-exclude',
552 );
553
554
555 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches);
556 $tagnames = array_intersect($shortcode_tags, $matches[1]);
557
558
559 if (!empty($tagnames)) {
560 $pattern = get_shortcode_regex($tagnames);
561
562 preg_match_all("/$pattern/", $content, $shortcodes);
563
564
565 foreach ($shortcodes[0] as $key => $shortcode_value) {
566
567 $shortcode = array();
568 $shortcode[1] = $shortcodes[1][$key];
569 $shortcode[2] = $shortcodes[2][$key];
570 $shortcode[3] = $shortcodes[3][$key];
571 $shortcode[4] = $shortcodes[4][$key];
572 $shortcode[5] = $shortcodes[5][$key];
573 $shortcode[6] = $shortcodes[6][$key];
574
575 $shortcode[3] .= " apply=\"true\"";
576 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
577 }
578 }
579
580
581 return $content;
582 }
583
584 /**
585 * Search and update shortcodes for this extension inside content
586 * Auto set of dataset id
587 *
588 * @param string $content - Content
589 *
590 * @return string - Content with updated shortcodes
591 */
592 public function filter_content($content) {
593 global $post;
594
595 if (false === strpos($content, '[')) {
596 return $content;
597 }
598
599 $shortcode_tags = array(
600 'e2pdf-download',
601 'e2pdf-view'
602 );
603
604 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches);
605 $tagnames = array_intersect($shortcode_tags, $matches[1]);
606
607 if (!empty($tagnames)) {
608 $pattern = get_shortcode_regex($tagnames);
609
610 preg_match_all("/$pattern/", $content, $shortcodes);
611
612 foreach ($shortcodes[0] as $key => $shortcode_value) {
613
614 wp_reset_postdata();
615
616 $shortcode = array();
617 $shortcode[1] = $shortcodes[1][$key];
618 $shortcode[2] = $shortcodes[2][$key];
619 $shortcode[3] = $shortcodes[3][$key];
620 $shortcode[4] = $shortcodes[4][$key];
621 $shortcode[5] = $shortcodes[5][$key];
622 $shortcode[6] = $shortcodes[6][$key];
623
624 $atts = shortcode_parse_atts($shortcode[3]);
625
626 if (!array_key_exists('dataset', $atts) && array_key_exists('id', $atts)) {
627 $template = new Model_E2pdf_Template();
628 $template->load($atts['id']);
629 if ($template->get('extension') === 'wordpress') {
630 if (isset($post->ID)) {
631 $dataset_id = $post->ID;
632 $atts['dataset'] = $dataset_id;
633 $shortcode[3] .= " dataset=\"{$dataset_id}\"";
634 }
635 }
636 }
637 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
638 }
639 }
640
641 return $content;
642 }
643
644 public function verify() {
645 $item_id = $this->get('item');
646 $dataset_id = $this->get('dataset');
647
648 if ($item_id && $dataset_id && $item_id == get_post_type($dataset_id)) {
649 return true;
650 }
651
652 return false;
653 }
654
655 public function visual_mapper() {
656
657 $vc = "<h3>Wordpress</h3>";
658 $vc .= "<div class='e2pdf-grid'>";
659 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("ID", "e2pdf"), 'id')}</div>";
660 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Author", "e2pdf"), 'post_author')}</div>";
661 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Date", "e2pdf"), 'post_date')}</div>";
662 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Date (GMT)", "e2pdf"), 'post_date_gmt')}</div>";
663 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Content", "e2pdf"), 'post_content')}</div>";
664 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Title", "e2pdf"), 'post_title')}</div>";
665 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Excerpt", "e2pdf"), 'post_excerpt')}</div>";
666 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Status", "e2pdf"), 'post_status')}</div>";
667 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Comment Status", "e2pdf"), 'comment_status')}</div>";
668 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Ping Status", "e2pdf"), 'ping_status')}</div>";
669 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Post Password", "e2pdf"), 'post_password')}</div>";
670 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Post Name", "e2pdf"), 'post_name')}</div>";
671 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("To Ping", "e2pdf"), 'to_ping')}</div>";
672 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Ping", "e2pdf"), 'pinged')}</div>";
673 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Modified Date", "e2pdf"), 'post_modified')}</div>";
674 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Modified Date (GMT)", "e2pdf"), 'post_modified_gmt')}</div>";
675 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Filtered Content", "e2pdf"), 'post_content_filtered')}</div>";
676 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Parent ID", "e2pdf"), 'post_parent')}</div>";
677 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("GUID", "e2pdf"), 'guid')}</div>";
678 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Menu Order", "e2pdf"), 'menu_order')}</div>";
679 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Type", "e2pdf"), 'post_type')}</div>";
680 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Mime Type", "e2pdf"), 'post_mime_type')}</div>";
681 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pr10'>{$this->get_vm_element(__("Comments Count", "e2pdf"), 'comment_count')}</div>";
682 $vc .= "<div class='e2pdf-ib e2pdf-w50 e2pdf-pl10'>{$this->get_vm_element(__("Filter", "e2pdf"), 'filter')}</div>";
683 $vc .= "</div>";
684 return $vc;
685 }
686
687 private function get_vm_element($name, $id) {
688 $element = "<div>";
689 $element .= "<label>{$name}:</label>";
690 $element .= "<input type='text' name='[{$id}]' value='[{$id}]'>";
691 $element .= "</div>";
692 return $element;
693 }
694
695 public function load_shortcodes() {
696 add_shortcode('e2pdf-exclude', array($this, 'shortcode_e2pdf_exclude'));
697 }
698
699 function shortcode_e2pdf_exclude($atts = array(), $content = null) {
700 if (is_array($atts) && array_key_exists('apply', $atts)) {
701 return '';
702 } else {
703 return $content;
704 }
705 }
706
707 }
708