|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class FrmEntryFormat { |
|
4
|
|
|
|
|
5
|
|
|
/*********************************************************************** |
|
6
|
|
|
* Deprecated Functions |
|
7
|
|
|
************************************************************************/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @deprecated 2.03.04 |
|
11
|
|
|
*/ |
|
12
|
|
|
public static function textarea_display_value() { |
|
13
|
|
|
_deprecated_function( __FUNCTION__, '2.03.04', 'custom code' ); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @deprecated 2.03.11 |
|
18
|
|
|
*/ |
|
19
|
|
|
public static function single_html_row( $atts, &$content ) { |
|
20
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @deprecated 2.03.11 |
|
25
|
|
|
* |
|
26
|
|
|
* @param stdClass $field |
|
27
|
|
|
* @param array|string $val |
|
28
|
|
|
*/ |
|
29
|
|
|
public static function flatten_multi_file_upload( $field, &$val ) { |
|
30
|
|
|
if ( $field->type == 'file' && FrmField::is_option_true( $field, 'multiple' ) ) { |
|
31
|
|
|
$val = FrmAppHelper::array_flatten( $val ); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @deprecated 2.03.11 |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function fill_entry_user_info() { |
|
41
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @deprecated 2.03.11 |
|
46
|
|
|
*/ |
|
47
|
|
|
public static function get_entry_description_data() { |
|
48
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
49
|
|
|
|
|
50
|
|
|
return array(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @deprecated 2.03.11 |
|
55
|
|
|
*/ |
|
56
|
|
|
public static function single_plain_text_row() { |
|
57
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @deprecated 2.03.11 |
|
62
|
|
|
*/ |
|
63
|
|
|
public static function html_field_row() { |
|
64
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'custom code' ); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @deprecated 2.03.11 |
|
69
|
|
|
*/ |
|
70
|
|
|
public static function fill_entry_values( $atts, $f, array &$values ) { |
|
71
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
72
|
|
|
|
|
73
|
|
|
$no_save_field = FrmField::is_no_save_field( $f->type ); |
|
74
|
|
|
if ( $no_save_field ) { |
|
75
|
|
|
if ( ! in_array( $f->type, $atts['include_extras'] ) ) { |
|
76
|
|
|
return; |
|
77
|
|
|
} |
|
78
|
|
|
$atts['include_blank'] = true; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
if ( $atts['default_email'] ) { |
|
82
|
|
|
self::get_field_shortcodes_for_default_email( $f, $values ); |
|
|
|
|
|
|
83
|
|
|
return; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
$atts['field'] = $f; |
|
87
|
|
|
|
|
88
|
|
|
self::fill_missing_fields( $atts, $values ); |
|
|
|
|
|
|
89
|
|
|
|
|
90
|
|
|
$val = ''; |
|
91
|
|
|
self::get_field_value( $atts, $val ); |
|
|
|
|
|
|
92
|
|
|
|
|
93
|
|
|
// Don't include blank values |
|
94
|
|
|
if ( ! $atts['include_blank'] && FrmAppHelper::is_empty_value( $val ) ) { |
|
95
|
|
|
return; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
self::prepare_field_output( $atts, $val ); |
|
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
if ( $atts['format'] != 'text' ) { |
|
101
|
|
|
$values[ $f->field_key ] = $val; |
|
102
|
|
|
if ( $atts['entry'] && $f->type != 'textarea' ) { |
|
103
|
|
|
$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
104
|
|
|
if ( $prev_val != $val ) { |
|
105
|
|
|
$values[ $f->field_key . '-value' ] = $prev_val; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
} else { |
|
109
|
|
|
$values[ $f->id ] = array( 'label' => $f->name, 'val' => $val, 'type' => $f->type ); |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @deprecated 2.03.11 |
|
115
|
|
|
*/ |
|
116
|
|
|
private static function fill_missing_fields( $atts, &$values ) { |
|
117
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
118
|
|
|
|
|
119
|
|
|
if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $atts['field']->id ] ) ) { |
|
120
|
|
|
// In case include_blank is set |
|
121
|
|
|
$atts['entry']->metas[ $atts['field']->id ] = ''; |
|
122
|
|
|
$atts['entry'] = apply_filters( 'frm_prepare_entry_content', $atts['entry'], array( 'field' => $atts['field'] ) ); |
|
123
|
|
|
self::fill_values_from_entry( $atts, $values ); |
|
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @deprecated 2.03.11 |
|
129
|
|
|
*/ |
|
130
|
|
|
public static function fill_values_from_entry( $atts, &$values ) { |
|
131
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
132
|
|
|
|
|
133
|
|
|
$values = apply_filters( 'frm_prepare_entry_array', $values, $atts ); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @deprecated 2.03.11 |
|
138
|
|
|
*/ |
|
139
|
|
|
public static function get_field_shortcodes_for_default_email( $f, &$values ) { |
|
140
|
|
|
// TODO: adjust this message |
|
141
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
142
|
|
|
|
|
143
|
|
|
$field_shortcodes = array( |
|
144
|
|
|
'label' => '[' . $f->id . ' show=field_label]', |
|
145
|
|
|
'val' => '[' . $f->id . ']', |
|
146
|
|
|
'type' => $f->type, |
|
147
|
|
|
); |
|
148
|
|
|
|
|
149
|
|
|
$values[ $f->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @deprecated 2.03.11 |
|
154
|
|
|
*/ |
|
155
|
|
|
private static function get_field_value( $atts, &$val ) { |
|
156
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
157
|
|
|
|
|
158
|
|
|
$f = $atts['field']; |
|
159
|
|
|
if ( $atts['entry'] ) { |
|
160
|
|
|
$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
161
|
|
|
$meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type ); |
|
|
|
|
|
|
162
|
|
|
|
|
163
|
|
|
//This filter applies to the default-message shortcode and frm-show-entry shortcode only |
|
164
|
|
|
if ( in_array( $f->type, array( 'html', 'divider', 'break' ) ) ) { |
|
165
|
|
|
$val = apply_filters( 'frm_content', $f->description, $atts['form_id'], $atts['entry'] ); |
|
166
|
|
|
} elseif ( isset( $atts['filter'] ) && $atts['filter'] == false ) { |
|
167
|
|
|
$val = $prev_val; |
|
168
|
|
|
} else { |
|
169
|
|
|
$email_value_atts = array( 'field' => $f, 'format' => $atts['format'] ); |
|
170
|
|
|
$val = apply_filters( 'frm_email_value', $prev_val, (object) $meta, $atts['entry'], $email_value_atts ); |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @since 2.03.02 |
|
177
|
|
|
* |
|
178
|
|
|
* @deprecated 2.03.11 |
|
179
|
|
|
*/ |
|
180
|
|
|
public static function prepare_field_output( $atts, &$val ) { |
|
181
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
182
|
|
|
|
|
183
|
|
|
$val = apply_filters( 'frm_display_' . $atts['field']->type . '_value_custom', $val, array( |
|
184
|
|
|
'field' => $atts['field'], 'atts' => $atts, |
|
185
|
|
|
) ); |
|
186
|
|
|
|
|
187
|
|
|
self::flatten_array_value( $atts, $val ); |
|
|
|
|
|
|
188
|
|
|
self::maybe_strip_html( $atts['plain_text'], $val ); |
|
|
|
|
|
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* @since 2.03.02 |
|
193
|
|
|
* |
|
194
|
|
|
* @deprecated 2.03.11 |
|
195
|
|
|
*/ |
|
196
|
|
|
private static function flatten_array_value( $atts, &$val ) { |
|
197
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
198
|
|
|
|
|
199
|
|
|
if ( is_array( $val ) ) { |
|
200
|
|
|
if ( $atts['format'] == 'text' ) { |
|
201
|
|
|
$val = implode( ', ', $val ); |
|
202
|
|
|
} else if ( $atts['field']->type == 'checkbox' ) { |
|
203
|
|
|
$val = array_values( $val ); |
|
204
|
|
|
} |
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* Strip HTML if from email value if plain text is selected |
|
210
|
|
|
* |
|
211
|
|
|
* @since 2.0.21 |
|
212
|
|
|
* @param boolean $plain_text |
|
213
|
|
|
* @param mixed $val |
|
214
|
|
|
* |
|
215
|
|
|
* @deprecated 2.03.11 |
|
216
|
|
|
*/ |
|
217
|
|
|
private static function maybe_strip_html( $plain_text, &$val ) { |
|
218
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'instance of FrmEntryValues or FrmProEntryValues' ); |
|
219
|
|
|
|
|
220
|
|
View Code Duplication |
if ( $plain_text && ! is_array( $val ) ) { |
|
|
|
|
|
|
221
|
|
|
if ( strpos( $val, '<img' ) !== false ) { |
|
222
|
|
|
$val = str_replace( array( '<img', 'src=', '/>', '"' ), '', $val ); |
|
223
|
|
|
$val = trim( $val ); |
|
224
|
|
|
} |
|
225
|
|
|
$val = strip_tags( $val ); |
|
226
|
|
|
} |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* @deprecated 2.03.11 |
|
231
|
|
|
*/ |
|
232
|
|
|
public static function get_browser( $u_agent ) { |
|
233
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'FrmEntriesHelper::get_browser' ); |
|
234
|
|
|
return FrmEntriesHelper::get_browser( $u_agent ); |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* @deprecated 2.03.11 |
|
239
|
|
|
*/ |
|
240
|
|
|
public static function show_entry( $atts ) { |
|
241
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'FrmEntriesController::show_entry_shortcode' ); |
|
242
|
|
|
return FrmEntriesController::show_entry_shortcode( $atts ); |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
/** |
|
246
|
|
|
* @deprecated 2.03.11 |
|
247
|
|
|
*/ |
|
248
|
|
|
public static function convert_entry_to_content() { |
|
249
|
|
|
_deprecated_function( __FUNCTION__, '2.03.11', 'FrmEntriesController::show_entry_shortcode' ); |
|
250
|
|
|
} |
|
251
|
|
|
} |
|
252
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.