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

718 lines 24.5 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 return $value;
218 }
219
220 /**
221 * Render shortcodes which available in this extension
222 *
223 * @param string $value - Content
224 * @param string $type - Type of rendering value
225 * @param array $field - Field details
226 *
227 * @return string - Value with rendered shortcodes
228 */
229 public function render_shortcodes($value, $type = false, $field = array()) {
230
231 $dataset_id = $this->get('dataset');
232 $item_id = $this->get('item');
233 $post = get_post($dataset_id);
234
235 $ext_shortcodes = array(
236 "[id]" => $post->ID,
237 "[post_author]" => get_userdata($post->post_author)->user_nicename,
238 "[post_date]" => $post->post_date,
239 "[post_date_gmt]" => $post->post_date_gmt,
240 "[post_content]" => $post->post_content,
241 "[post_title]" => $post->post_title,
242 "[post_excerpt]" => $post->post_excerpt,
243 "[post_status]" => $post->post_status,
244 "[comment_status]" => $post->comment_status,
245 "[ping_status]" => $post->ping_status,
246 "[post_password]" => $post->post_password,
247 "[post_name]" => $post->post_name,
248 "[to_ping]" => $post->to_ping,
249 "[pinged]" => $post->pinged,
250 "[post_modified]" => $post->post_modified,
251 "[post_modified_gmt]" => $post->post_modified_gmt,
252 "[post_content_filtered]" => $post->post_content_filtered,
253 "[post_parent]" => $post->post_parent,
254 "[guid]" => $post->guid,
255 "[menu_order]" => $post->menu_order,
256 "[post_type]" => $post->post_type,
257 "[post_mime_type]" => $post->post_mime_type,
258 "[comment_count]" => $post->comment_count,
259 "[filter]" => $post->filter
260 );
261
262
263 $post_content = false;
264
265 if (false !== strpos($value, '[')) {
266
267 $shortcode_tags = array(
268 'meta',
269 );
270 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $value, $matches);
271 $tagnames = array_intersect($shortcode_tags, $matches[1]);
272
273 if (!empty($tagnames)) {
274 $pattern = get_shortcode_regex($tagnames);
275
276 preg_match_all("/$pattern/", $value, $shortcodes);
277
278 foreach ($shortcodes[0] as $key => $shortcode_value) {
279 $shortcode = array();
280 $shortcode[1] = $shortcodes[1][$key];
281 $shortcode[2] = $shortcodes[2][$key];
282 $shortcode[3] = $shortcodes[3][$key];
283 $shortcode[4] = $shortcodes[4][$key];
284 $shortcode[5] = $shortcodes[5][$key];
285 $shortcode[6] = $shortcodes[6][$key];
286
287 $atts = shortcode_parse_atts($shortcode[3]);
288
289 if (array_key_exists('key', $atts)) {
290 $value = str_replace($shortcode_value, get_post_meta($post->ID, $atts['key'], true), $value);
291 }
292 }
293 }
294
295 $shortcode_tags = array(
296 'e2pdf-format-number',
297 'e2pdf-format-date',
298 'e2pdf-format-output',
299 );
300 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $value, $matches);
301 $tagnames = array_intersect($shortcode_tags, $matches[1]);
302
303 if (!empty($tagnames)) {
304
305 $pattern = get_shortcode_regex($tagnames);
306 preg_match_all("/$pattern/", $value, $shortcodes);
307 foreach ($shortcodes[0] as $key => $shortcode_value) {
308 $shortcode = array();
309 $shortcode[1] = $shortcodes[1][$key];
310 $shortcode[2] = $shortcodes[2][$key];
311 $shortcode[3] = $shortcodes[3][$key];
312 $shortcode[4] = $shortcodes[4][$key];
313 $shortcode[5] = $shortcodes[5][$key];
314 $shortcode[6] = $shortcodes[6][$key];
315
316 if (isset($shortcode['5'])) {
317
318 if (strpos($shortcode['5'], "[post_content]") !== FALSE && !$this->get('no_filter') && !$post_content) {
319 $ext_shortcodes['[post_content]'] = $this->before_render_post_content($ext_shortcodes['[post_content]']);
320 $ext_shortcodes['[post_content]'] = apply_filters('the_content', $ext_shortcodes['[post_content]']);
321 $ext_shortcodes['[post_content]'] = str_replace("</p>", "</p>&nbsp;\r\n", $ext_shortcodes['[post_content]']);
322 $post_content = true;
323 }
324
325 $sub_value = str_replace(array_keys($ext_shortcodes), $ext_shortcodes, $shortcode['5']);
326 $value = str_replace($shortcode_value, "[" . $shortcode['2'] . $shortcode['3'] . "]" . $sub_value . "[/" . $shortcode['2'] . "]", $value);
327 }
328 }
329 }
330 }
331
332 $value = do_shortcode($value);
333
334
335 if (isset($field['type']) && ($field['type'] === 'e2pdf-image' || $field['type'] === 'e2pdf-signature')) {
336 $esig = isset($field['properties']['esig']) && $field['properties']['esig'] ? true : false;
337 if ($esig) {
338 //process e-signature
339 $value = "";
340 } else {
341 $helper_e2pdf_image = new Helper_E2pdf_Image();
342 if (!$helper_e2pdf_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->hexColorAllocate($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 }
388
389
390 if (strpos($value, "[post_content]") !== FALSE && !$this->get('no_filter') && !$post_content) {
391 $ext_shortcodes['[post_content]'] = $this->before_render_post_content($ext_shortcodes['[post_content]']);
392 $ext_shortcodes['[post_content]'] = apply_filters('the_content', $ext_shortcodes['[post_content]']);
393 $ext_shortcodes['[post_content]'] = str_replace("</p>", "</p>&nbsp;\r\n", $ext_shortcodes['[post_content]']);
394 $post_content = true;
395 }
396
397 $value = str_replace(array_keys($ext_shortcodes), $ext_shortcodes, $value);
398
399 return $value;
400 }
401
402 public function filter_custom_shortcodes() {
403
404 }
405
406 /**
407 * Strip unused shortcodes
408 *
409 * @param string $value - Content
410 *
411 * @return string - Value with removed unused shortcodes
412 */
413 public function strip_shortcodes($value) {
414 $value = preg_replace('~(?:\[/?)[^/\]]+/?\]~s', "", $value);
415 return $value;
416 }
417
418 public function auto() {
419 $response = array();
420 $elements = array();
421
422
423 $post = $this->get('item');
424
425 $elements[] = array(
426 'type' => 'e2pdf-html',
427 'top' => '20',
428 'left' => '20',
429 'right' => '20',
430 'block' => true,
431 'properties' => array(
432 'value' => "<h1>[post_title]</h1>",
433 )
434 );
435
436
437 $elements[] = array(
438 'type' => 'e2pdf-html',
439 'top' => '20',
440 'left' => '20',
441 'right' => '20',
442 'block' => true,
443 'properties' => array(
444 'value' => __("Post name", 'e2pdf') . ": [post_name]",
445 )
446 );
447
448 $elements[] = array(
449 'type' => 'e2pdf-html',
450 'top' => '20',
451 'left' => '20',
452 'right' => '20',
453 'block' => true,
454 'properties' => array(
455 'value' => __("Post type", 'e2pdf') . ": [post_type]",
456 )
457 );
458
459
460 $elements[] = array(
461 'type' => 'e2pdf-html',
462 'top' => '20',
463 'left' => '20',
464 'right' => '20',
465 'block' => true,
466 'properties' => array(
467 'value' => __("ID", 'e2pdf') . ": [id]",
468 )
469 );
470
471 $elements[] = array(
472 'type' => 'e2pdf-html',
473 'top' => '20',
474 'left' => '20',
475 'right' => '20',
476 'block' => true,
477 'properties' => array(
478 'value' => __("Author", 'e2pdf') . ": [post_author]",
479 )
480 );
481
482
483
484 $elements[] = array(
485 'type' => 'e2pdf-html',
486 'top' => '20',
487 'left' => '20',
488 'right' => '20',
489 'block' => true,
490 'properties' => array(
491 'value' => "[post_content]",
492 'dynamic_height' => '1',
493 'height' => '300',
494 )
495 );
496
497
498 $elements[] = array(
499 'type' => 'e2pdf-html',
500 'top' => '20',
501 'left' => '20',
502 'right' => '20',
503 'block' => true,
504 'properties' => array(
505 'value' => __("Created", 'e2pdf') . ": [post_date]",
506 )
507 );
508
509 $elements[] = array(
510 'type' => 'e2pdf-html',
511 'top' => '20',
512 'left' => '20',
513 'right' => '20',
514 'block' => true,
515 'properties' => array(
516 'value' => __("Modified", 'e2pdf') . ": [post_modified]",
517 )
518 );
519
520
521 $response['page'] = array(
522 'bottom' => '20',
523 'top' => '20',
524 );
525
526
527
528 $response['elements'] = $elements;
529 return $response;
530 }
531
532 /**
533 * Action before wordpress post/page render
534 * Force to apply e2pdf shortcodes
535 *
536 * @param string $content - Content
537 *
538 * @return string - Content with update shortcodes
539 */
540 public function before_render_post_content($content) {
541
542 if (false === strpos($content, '[')) {
543 return $content;
544 }
545
546
547 $shortcode_tags = array(
548 'e2pdf-exclude',
549 );
550
551
552 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches);
553 $tagnames = array_intersect($shortcode_tags, $matches[1]);
554
555
556 if (!empty($tagnames)) {
557 $pattern = get_shortcode_regex($tagnames);
558
559 preg_match_all("/$pattern/", $content, $shortcodes);
560
561
562 foreach ($shortcodes[0] as $key => $shortcode_value) {
563
564 $shortcode = array();
565 $shortcode[1] = $shortcodes[1][$key];
566 $shortcode[2] = $shortcodes[2][$key];
567 $shortcode[3] = $shortcodes[3][$key];
568 $shortcode[4] = $shortcodes[4][$key];
569 $shortcode[5] = $shortcodes[5][$key];
570 $shortcode[6] = $shortcodes[6][$key];
571
572 $shortcode[3] .= " apply='true'";
573 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
574 }
575 }
576
577
578 return $content;
579 }
580
581 /**
582 * Search and update shortcodes for this extension inside content
583 * Auto set of dataset id
584 *
585 * @param string $content - Content
586 *
587 * @return string - Content with updated shortcodes
588 */
589 public function filter_content($content) {
590 global $post;
591
592 if (false === strpos($content, '[')) {
593 return $content;
594 }
595
596 $shortcode_tags = array(
597 'e2pdf-download',
598 'e2pdf-view'
599 );
600
601 preg_match_all('@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches);
602 $tagnames = array_intersect($shortcode_tags, $matches[1]);
603
604 if (!empty($tagnames)) {
605 $pattern = get_shortcode_regex($tagnames);
606
607 preg_match_all("/$pattern/", $content, $shortcodes);
608
609 foreach ($shortcodes[0] as $key => $shortcode_value) {
610
611 wp_reset_postdata();
612 $extension = false;
613 $item = false;
614
615 $shortcode = array();
616 $shortcode[1] = $shortcodes[1][$key];
617 $shortcode[2] = $shortcodes[2][$key];
618 $shortcode[3] = $shortcodes[3][$key];
619 $shortcode[4] = $shortcodes[4][$key];
620 $shortcode[5] = $shortcodes[5][$key];
621 $shortcode[6] = $shortcodes[6][$key];
622
623 $atts = shortcode_parse_atts($shortcode[3]);
624
625 if (array_key_exists('id', $atts)) {
626 $template = new Model_E2pdf_Template();
627 $template->load($atts['id']);
628 if ($template->get('extension') === 'wordpress') {
629 $extension = $template->get('extension');
630 $item = $template->get('item');
631 }
632 }
633
634 if ($extension) {
635 if (!array_key_exists('dataset', $atts)) {
636 if (isset($post->ID)) {
637 $dataset_id = $post->ID;
638 $atts['dataset'] = $dataset_id;
639 $shortcode[3] .= " dataset='{$dataset_id}'";
640 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
641 }
642 } else {
643 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
644 }
645 } elseif ($shortcode[2] === 'e2pdf-view') {
646 $content = str_replace($shortcode_value, do_shortcode_tag($shortcode), $content);
647 }
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