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

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