PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.4
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 5.4.4, at deprecated/FrmEntryFormat.php

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