PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.00.13
E2Pdf – Export Pdf Tool for WordPress v1.00.13
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.00.13, at classes/extension/e2pdf-wordpress.php

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