PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.6
JetFormBuilder — Dynamic Blocks Form Builder v3.1.6
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 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / form-messages / builder.php
jetformbuilder / includes / form-messages Last commit date
actions 2 years ago action-messages-manager.php 2 years ago builder.php 2 years ago manager.php 2 years ago msg-router.php 2 years ago status-info.php 2 years ago
builder.php
105 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Form_Messages;
5
6 // If this file is called directly, abort.
7 use Jet_Form_Builder\Classes\Get_Template_Trait;
8
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 /**
14 * Form messages class
15 */
16 class Builder {
17
18 use Get_Template_Trait;
19
20 private $status;
21
22 /**
23 * Set form submittion status
24 *
25 * @param [type] $status [description]
26 *
27 * @return Builder
28 */
29 public function set_form_status( $status ) {
30 $this->status = $status;
31
32 return $this;
33 }
34
35 public function get_manager( $data = array() ) {
36 return jet_form_builder()->msg_router->get_manager( $data );
37 }
38
39 /**
40 * Get form submitting status
41 */
42 public function get_form_status() {
43 if ( ! $this->status ) {
44 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
45 $this->status = isset( $_GET['status'] ) ? sanitize_text_field( wp_unslash( $_GET['status'] ) ) : null;
46 }
47
48 return $this->status;
49 }
50
51 public function render_empty_field_message() {
52 $message_content = $this->get_manager()->get_message( 'empty_field' );
53
54 include $this->get_global_template( 'common/field-message.php' );
55 }
56
57 /**
58 * Render form messages
59 *
60 * @return void
61 */
62 public function render_messages() {
63 $status = $this->get_form_status();
64
65 if ( ! $status ) {
66 return;
67 }
68
69 $info = new Status_Info( $status );
70 $message_content = $this->get_manager()->get_message_by_info( $info );
71
72 $class = 'jet-form-builder-message';
73 $class .= ' jet-form-builder-message--' . $info->get_css_class();
74
75 include $this->get_global_template( 'common/messages.php' );
76 }
77
78 /**
79 * Render message samples for editor
80 *
81 * @return [type] [description]
82 */
83 public function render_messages_samples() {
84 // Render success sample
85 $this->set_form_status( 'success' );
86 $this->render_messages();
87
88 // Render error sample
89 $this->set_form_status( 'failed' );
90 $this->render_messages();
91
92 // Reset status
93 $this->set_form_status( null );
94 }
95
96 public function get_rendered_messages() {
97 ob_start();
98 $this->render_messages();
99
100 return ob_get_clean();
101 }
102
103
104 }
105