PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.1
JetFormBuilder — Dynamic Blocks Form Builder v3.0.1
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 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 / post-meta / messages-meta.php
jetformbuilder / includes / post-meta Last commit date
actions-meta.php 3 years ago args-meta.php 3 years ago base-meta-type.php 3 years ago gateways-meta.php 3 years ago messages-meta.php 3 years ago preset-meta.php 3 years ago recaptcha-meta.php 3 years ago validation-meta.php 3 years ago
messages-meta.php
113 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Post_Meta;
5
6
7 use Jet_Form_Builder\Classes\Tools;
8
9 class Messages_Meta extends Base_Meta_Type {
10
11 private $messages;
12
13 public function __construct() {
14 $this->messages = apply_filters(
15 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
16 'jet-form-builder/message-types',
17 $this->get_messages()
18 );
19 }
20
21 public function get_id(): string {
22 return '_jf_messages';
23 }
24
25 public function get_type(): string {
26 return 'string';
27 }
28
29 public function get_default(): string {
30 return Tools::encode_json( $this->get_values() );
31 }
32
33 private function get_messages(): array {
34 return array(
35 'success' => array(
36 'label' => __( 'Form successfully submitted.', 'jet-form-builder' ),
37 'value' => 'Form successfully submitted.',
38 ),
39 'failed' => array(
40 'label' => __( 'Submit failed.', 'jet-form-builder' ),
41 'value' => 'There was an error trying to submit form. Please try again later.',
42 ),
43 'validation_failed' => array(
44 'label' => __( 'Validation error', 'jet-form-builder' ),
45 'value' => 'One or more fields have an error. Please check and try again.',
46 ),
47 'captcha_failed' => array(
48 'label' => __( 'Captcha validation failed', 'jet-form-builder' ),
49 'value' => __( 'Captcha validation failed', 'jet-form-builder' ),
50 ),
51 'invalid_email' => array(
52 'label' => __( 'Entered an invalid email', 'jet-form-builder' ),
53 'value' => 'The e-mail address entered is invalid.',
54 ),
55 'empty_field' => array(
56 'label' => __( 'Required field is empty', 'jet-form-builder' ),
57 'value' => 'The field is required.',
58 ),
59 'internal_error' => array(
60 'label' => __( 'Internal server error', 'jet-form-builder' ),
61 'value' => 'Internal server error. Please try again later.',
62 ),
63 'upload_max_files' => array(
64 'label' => __( 'Media Specific: Max files limit', 'jet-form-builder' ),
65 'value' => 'Maximum upload files limit is reached.',
66 ),
67 'upload_max_size' => array(
68 'label' => __( 'Media Specific: Max size reached', 'jet-form-builder' ),
69 'value' => 'Upload max size exceeded.',
70 ),
71 'upload_mime_types' => array(
72 'label' => __( 'Media Specific: File type error', 'jet-form-builder' ),
73 'value' => 'File type is not allowed.',
74 ),
75 );
76 }
77
78 public function messages(): array {
79 return $this->messages;
80 }
81
82 public function query( $form_id ) {
83 $messages = parent::query( $form_id );
84
85 if ( empty( $messages ) ) {
86 return $this->messages;
87 }
88
89 return $messages;
90 }
91
92
93 public function get_values() {
94 return $this->get_by_key( 'label' );
95 }
96
97 public function get_labels(): array {
98 return $this->get_by_key( 'label' );
99 }
100
101 public function get_by_key( $key ): array {
102 $messages = array();
103
104 foreach ( $this->messages as $type => $message ) {
105 if ( ! isset( $message[ $key ] ) ) {
106 break;
107 }
108 $messages[ $type ] = $message[ $key ];
109 }
110
111 return $messages;
112 }
113 }