PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.01.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.01.02
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / deprecated / FrmEntryFormat.php

FrmEntryFormat.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 4.01.02, at deprecated/FrmEntryFormat.php

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