PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
← All changes | includes/form-messages/builder.php +29 -10 3.6.5.1 → 3.6.6 View file →
@@ -4,9 +4,8 @@
4 4 namespace Jet_Form_Builder\Form_Messages;
5 5
6 6 // If this file is called directly, abort.
7 7 use Jet_Form_Builder\Classes\Get_Template_Trait;
8 -use JFB_Modules\Rich_Content;
9 8
10 9 if ( ! defined( 'WPINC' ) ) {
11 10 die;
12 11 }
@@ -20,8 +19,13 @@
20 19
21 20 private $status;
22 21
23 22 /**
23 + * @var Message_Content_Processor
24 + */
25 + private $content_processor;
26 +
27 + /**
24 28 * Set form submittion status
25 29 *
26 30 * @param [type] $status [description]
27 31 *
@@ -49,9 +53,9 @@
49 53 return $this->status;
50 54 }
51 55
52 56 public function prepare_message_content( string $message ): string {
53 - return jet_fb_handler()->parser->parse_macros(
57 + return $this->get_content_processor()->prepare_macros(
54 58 $message,
55 59 jet_fb_context()->get_request()
56 60 );
57 61 }
@@ -56,10 +60,11 @@
56 60 );
57 61 }
58 62
59 63 public function render_empty_field_message() {
60 - $message_content = $this->prepare_message_content(
61 - $this->get_manager()->get_message( 'empty_field' )
64 + $message_content = $this->get_content_processor()->prepare_trusted(
65 + $this->get_manager()->get_message( 'empty_field' ),
66 + jet_fb_context()->get_request()
62 67 );
63 68
64 69 include $this->get_global_template( 'common/field-message.php' );
65 70 }
@@ -75,15 +80,21 @@
75 80 if ( ! $status ) {
76 81 return;
77 82 }
78 83
79 - $info = new Status_Info( $status );
84 + $info = new Status_Info( $status );
85 + $manager = $this->get_manager();
86 + $message = $manager->get_message_by_info( $info );
80 87
81 - $message_content = Rich_Content\Module::rich(
82 - $this->prepare_message_content(
83 - $this->get_manager()->get_message_by_info( $info )
84 - )
85 - );
88 + // Only a registered key resolves to a template stored in form/action settings.
89 + if ( ! $info->is_dynamic() && $manager->isset_message_type( $info->get_message() ) ) {
90 + $message_content = $this->get_content_processor()->prepare_trusted(
91 + $message,
92 + jet_fb_context()->get_request()
93 + );
94 + } else {
95 + $message_content = $this->get_content_processor()->prepare_untrusted( $message );
96 + }
86 97
87 98 $class = 'jet-form-builder-message';
88 99 $class .= ' jet-form-builder-message--' . $info->get_css_class();
89 100
@@ -110,8 +121,16 @@
110 121 ob_start();
111 122 $this->render_messages();
112 123
113 124 return ob_get_clean();
125 + }
126 +
127 + public function get_content_processor(): Message_Content_Processor {
128 + if ( is_null( $this->content_processor ) ) {
129 + $this->content_processor = new Message_Content_Processor();
130 + }
131 +
132 + return $this->content_processor;
114 133 }
115 134
116 135
117 136 }