PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.56
E2Pdf – Export Pdf Tool for WordPress v1.32.56
1.32.55 1.32.56 1.32.53 1.32.51 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 All 76 releases
← All changes | classes/extension/e2pdf-formidable.php +66 -43 1.32.18 → 1.32.56 View file →
@@ -92,8 +92,14 @@
92 92 $this->set('cached_entry', get_transient('e2pdf_' . $this->get('dataset')));
93 93 } else {
94 94 $entry = FrmEntry::getOne($this->get('dataset'));
95 95 if ($entry && isset($entry->form_id) && $entry->form_id == $this->get('cached_form')->id) {
96 + if (!empty($entry->parent_item_id)) {
97 + $parent_entry = FrmEntry::getOne($entry->parent_item_id);
98 + if ($parent_entry && isset($parent_entry->form_id)) {
99 + $entry->parent_entry = $parent_entry;
100 + }
101 + }
96 102 $this->set('cached_entry', $entry);
97 103 }
98 104 }
99 105 }
@@ -101,8 +107,14 @@
101 107 case 'dataset2':
102 108 if ($this->get('cached_form2') && $this->get('dataset2') && class_exists('FrmEntry')) {
103 109 $entry = FrmEntry::getOne($this->get('dataset2'));
104 110 if ($entry && isset($entry->form_id) && $entry->form_id == $this->get('cached_form2')->id) {
111 + if (!empty($entry->parent_item_id)) {
112 + $parent_entry = FrmEntry::getOne($entry->parent_item_id);
113 + if ($parent_entry && isset($parent_entry->form_id)) {
114 + $entry->parent_entry = $parent_entry;
115 + }
116 + }
105 117 $this->set('cached_entry2', $entry);
106 118 }
107 119 }
108 120 break;
@@ -327,8 +339,18 @@
327 339 add_filter('frm_row_actions', array($this, 'hook_formidable_row_actions'), 10, 2);
328 340
329 341 // frm-graph
330 342 add_filter('frm_graph_shortcode_custom_html', array($this, 'filter_frm_graph_shortcode_custom_html'), 99, 2);
343 +
344 + // extension hooks
345 + add_filter('e2pdf_extension_hooks', function ($hooks) {
346 + $hooks[$this->info['key']] = [
347 + 'hook_formidable_entry_view' => __('WP Admin Entry View', 'e2pdf'),
348 + 'hook_formidable_entry_edit' => __('WP Admin Entry Edit', 'e2pdf'),
349 + 'hook_formidable_row_actions' => __('WP Admin Entry Row Actions', 'e2pdf')
350 + ];
351 + return $hooks;
352 + });
331 353 }
332 354
333 355 public function action_frm_success_action() {
334 356 $this->set('iframe_download', true);
@@ -579,20 +601,8 @@
579 601 if ($checkbox_separated) {
580 602 remove_filter('frm_display_value_custom', array($this, 'filter_frm_display_value_custom'), 0);
581 603 }
582 604
583 - /* Bug fix for Formidable Forms Signature (2.0.1) */
584 - if (class_exists('FrmFieldFactory')) {
585 - $signature_field = FrmFieldFactory::get_field_type('signature');
586 - if ($signature_field->get_display_value('signature') == '') {
587 - $signature = true;
588 - }
589 - }
590 - if ($signature) {
591 - remove_filter('frm_get_signature_display_value', 'FrmSigAppController::display_signature');
592 - remove_filter('frmpro_fields_replace_shortcodes', 'FrmSigAppController::custom_display_signature');
593 - add_filter('frm_keep_signature_value_array', array($this, 'filter_frm_keep_signature_value_array'), 10, 2);
594 - }
595 605 add_filter('frmpro_fields_replace_shortcodes', array($this, 'filter_frmpro_fields_replace_shortcodes'), 20, 4);
596 606
597 607 $text_signature = !empty($field['type']) && ($field['type'] == 'e2pdf-image' || $field['type'] == 'e2pdf-signature') ? true : false;
598 608 if ($text_signature) {
@@ -651,13 +661,8 @@
651 661 $field['properties']['text'] = '1';
652 662 }
653 663 }
654 664 remove_filter('frmpro_fields_replace_shortcodes', array($this, 'filter_frmpro_fields_replace_shortcodes'), 20);
655 - if ($signature) {
656 - remove_filter('frm_keep_signature_value_array', array($this, 'filter_frm_keep_signature_value_array'));
657 - add_filter('frm_get_signature_display_value', 'FrmSigAppController::display_signature', 10, 3);
658 - add_filter('frmpro_fields_replace_shortcodes', 'FrmSigAppController::custom_display_signature', 10, 4);
659 - }
660 665 $value = $this->replace_meta_shortcodes($value);
661 666 $value = $this->helper->load('field')->render(
662 667 apply_filters('e2pdf_extension_render_shortcodes_pre_value', $value, $element_id, $this->get('template_id'), $this->get('item'), $this->get('dataset'), $this->get('item2'), $this->get('dataset2')),
663 668 $this,
@@ -722,12 +727,8 @@
722 727 }
723 728 return $is_filter_needed;
724 729 }
725 730
726 - public function filter_frm_keep_signature_value_array($keep_array, $atts) {
727 - return true;
728 - }
729 -
730 731 /**
731 732 * Search and update shortcodes for this extension inside content
732 733 * Auto set of dataset id
733 734 * @param string $content - Content
@@ -877,29 +878,49 @@
877 878 $replace_with = FrmProEntryMetaHelper::get_post_or_meta_value($this->get('cached_entry2'), $field, $atts);
878 879 }
879 880 }
880 881
881 - if ($field->type === 'checkbox' && is_array($replace_with)) {
882 - if (isset($atts['key']) && $atts['key']) {
883 - if (isset($replace_with[$atts['key']])) {
884 - $replace_with = $replace_with[$atts['key']];
885 - } else {
886 - $replace_with = '';
882 + switch ($field->type) {
883 + case 'checkbox':
884 + if (is_array($replace_with) && isset($atts['key']) && $atts['key']) {
885 + if (isset($replace_with[$atts['key']])) {
886 + $replace_with = $replace_with[$atts['key']];
887 + } else {
888 + $replace_with = '';
889 + }
887 890 }
888 - }
889 - }
890 -
891 - if ($field->type === 'radio') {
892 - if (isset($atts['key']) && $atts['key'] === 'other') {
893 - if (isset($field->options) && is_array($field->options)) {
894 - $field_key = array_search($replace_with, array_column($field->options, 'value'));
895 - if ($field_key !== false) {
896 - $replace_with = '';
891 + break;
892 + case 'radio':
893 + if (isset($atts['key']) && $atts['key'] === 'other') {
894 + if (isset($field->options) && is_array($field->options)) {
895 + $field_key = array_search($replace_with, array_column($field->options, 'value'));
896 + if ($field_key !== false) {
897 + $replace_with = '';
898 + }
897 899 }
898 900 }
899 - }
901 + break;
902 + case 'signature':
903 + if (is_array($replace_with)) {
904 + if (!empty($replace_with['format']) && $replace_with['format'] == 'drawn' && !empty($replace_with['output'])) {
905 + if (strpos($replace_with['output'], 'data:image') === 0) {
906 + $replace_with = $replace_with['output'];
907 + } elseif (strpos($replace_with['output'], '[{"lx":') === 0 && isset($replace_with['content'])) {
908 + if (class_exists('FrmSigAppController') && is_callable(['FrmSigAppController', 'get_signature_file_directory'])) {
909 + $file_path = FrmSigAppController::get_signature_file_directory() . '/' . $replace_with['content'];
910 + if (file_exists($file_path) && is_readable($file_path)) {
911 + $replace_with = $file_path;
912 + } else {
913 + $replace_with = '';
914 + }
915 + }
916 + }
917 + }
918 + }
919 + break;
920 + default:
921 + break;
900 922 }
901 -
902 923 return $replace_with;
903 924 }
904 925
905 926 /**
@@ -3514,10 +3535,12 @@
3514 3535 $html = '';
3515 3536 $source = '';
3516 3537
3517 3538 if ($this->get('item') && class_exists('FrmformsController')) {
3518 - if ($this->get('cached_form') && $this->get('cached_form')->parent_form_id) {
3519 - return '<div class="e2pdf-vm-error">' . __("Child form doesn't support Visual Mapper", 'e2pdf') . '</div>';
3539 + $child = false;
3540 + if ($this->get('cached_form') && !empty($this->get('cached_form')->parent_form_id)) {
3541 + $child = true;
3542 + $this->set('item', $this->get('cached_form')->parent_form_id);
3520 3543 }
3521 3544 if (class_exists('FrmProFieldsHelper')) {
3522 3545 add_filter('frm_get_paged_fields', array($this, 'filter_remove_pagebreaks'), 9);
3523 3546 }
@@ -3621,12 +3644,12 @@
3621 3644 /*
3622 3645 * Metas patterns to replace field names
3623 3646 * @since 0.01.42
3624 3647 */
3625 - $metas_pattern = array(
3626 - '/item_meta\[(?:.*?)\]\[0\]\[(.*?)\](?:\[\])?/i' => '$1:1',
3648 + $metas_pattern = [
3649 + '/item_meta\[(?:.*?)\]\[0\]\[(.*?)\](?:\[\])?/i' => $child ? '$1' : '$1:1',
3627 3650 '/item_meta\[(.*?)\](\[\])?/i' => '$1',
3628 - );
3651 + ];
3629 3652
3630 3653 // replace names
3631 3654 $metas = $xpath->query("//*[contains(@name, 'item_meta')]");
3632 3655 foreach ($metas as $element) {