PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.2.3
JetFormBuilder — Dynamic Blocks Form Builder v3.2.3
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 / status-info.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
status-info.php
93 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Form_Messages;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 class Status_Info {
12
13 private $raw = '';
14 private $is_dynamic;
15 private $is_success;
16 private $parsed;
17
18 public function __construct( string $status ) {
19 $this->raw = $status;
20 }
21
22 /**
23 * @return string
24 */
25 public function get_raw_message(): string {
26 return $this->raw;
27 }
28
29 public function is_dynamic(): bool {
30 if ( is_null( $this->is_dynamic ) ) {
31 $this->set_dynamic_and_success();
32 }
33
34 return $this->is_dynamic;
35 }
36
37 public function is_success(): bool {
38 if ( is_null( $this->is_success ) ) {
39 $this->set_dynamic_and_success();
40 }
41
42 return $this->is_success;
43 }
44
45 public function get_parsed(): array {
46 if ( ! is_array( $this->parsed ) ) {
47 $this->parsed = Manager::parse_message( $this->raw );
48 }
49
50 return $this->parsed;
51 }
52
53 public function get_message(): string {
54 $parsed = $this->get_parsed();
55
56 if ( $this->is_dynamic() ) {
57 return $parsed[1] ?? $parsed[0];
58 }
59
60 return $parsed[0];
61 }
62
63 private function set_dynamic_and_success(): Status_Info {
64 $dynamic = Manager::dynamic_types();
65 $message = $this->get_parsed();
66 $this->is_dynamic = isset( $dynamic[ $message[0] ] ) && ! empty( $message[1] );
67
68 if ( $this->is_dynamic ) {
69 $this->is_success = ( 'success' === ( $dynamic[ $message[0] ]['type'] ?? '' ) );
70 } else {
71 $this->is_success = in_array( $message[0], array( 'success' ), true );
72 }
73
74 do_action( 'jet-form-builder/response-status/init', $this );
75
76 return $this;
77 }
78
79
80 public function get_css_class(): string {
81 return $this->is_success() ? 'success' : 'error';
82 }
83
84 /**
85 * @since 3.2.2
86 * @param bool $is_success
87 */
88 public function set_is_success( bool $is_success ) {
89 $this->is_success = $is_success;
90 }
91
92 }
93