PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.9.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.9.1
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 / FrmDeprecated.php

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

552 lines 15.1 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 * Class FrmDeprecated
8 *
9 * @since 3.04.03
10 * @codeCoverageIgnore
11 */
12 class FrmDeprecated {
13
14 /**
15 * @deprecated 2.3
16 */
17 public static function deprecated( $function, $version ) {
18 _deprecated_function( $function, $version );
19 }
20
21 /**
22 * @deprecated 4.0
23 */
24 public static function new_form( $values = array() ) {
25 _deprecated_function( __FUNCTION__, '4.0', 'FrmFormsController::edit' );
26
27 FrmAppHelper::permission_check( 'frm_edit_forms' );
28
29 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
30 $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
31
32 if ( $action === 'create' ) {
33 FrmFormsController::update( $values );
34 return;
35 }
36
37 $values = FrmFormsHelper::setup_new_vars( $values );
38 $id = FrmForm::create( $values );
39 $values['id'] = $id;
40
41 FrmFormsController::edit( $values );
42 }
43
44 /**
45 * @deprecated 4.0
46 */
47 public static function update_order() {
48 _deprecated_function( __FUNCTION__, '4.0' );
49 FrmAppHelper::permission_check( 'frm_edit_forms' );
50 check_ajax_referer( 'frm_ajax', 'nonce' );
51
52 $fields = FrmAppHelper::get_post_param( 'frm_field_id' );
53 foreach ( (array) $fields as $position => $item ) {
54 FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) );
55 }
56 wp_die();
57 }
58
59 /**
60 * @deprecated 4.0
61 * @param array $values - The form array
62 */
63 public static function builder_submit_button( $values ) {
64 _deprecated_function( __FUNCTION__, '4.0' );
65 $page_action = FrmAppHelper::get_param( 'frm_action' );
66 $label = ( $page_action == 'edit' || $page_action === 'update' ) ? __( 'Update', 'formidable' ) : __( 'Create', 'formidable' );
67
68 ?>
69 <div class="postbox">
70 <p class="inside">
71 <button class="frm_submit_<?php echo esc_attr( ( ! empty( $values['ajax_load'] ) ) ? '' : 'no_' ); ?>ajax button-primary frm_button_submit" type="button">
72 <?php echo esc_html( $label ); ?>
73 </button>
74 </p>
75 </div>
76 <?php
77 }
78
79 /**
80 * @deprecated 3.04.03
81 */
82 public static function get_licenses() {
83 _deprecated_function( __FUNCTION__, '3.04.03' );
84
85 $allow_autofill = self::allow_autofill();
86 $required_role = $allow_autofill ? 'setup_network' : 'frm_change_settings';
87 FrmAppHelper::permission_check( $required_role );
88 check_ajax_referer( 'frm_ajax', 'nonce' );
89
90 if ( is_multisite() && get_site_option( 'frmpro-wpmu-sitewide' ) ) {
91 $license = get_site_option( 'frmpro-credentials' );
92 } else {
93 $license = get_option( 'frmpro-credentials' );
94 }
95
96 if ( $license && is_array( $license ) && isset( $license['license'] ) ) {
97 $url = 'https://formidableforms.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) );
98 $licenses = self::send_api_request(
99 $url,
100 array(
101 'name' => 'frm_api_licence',
102 'expires' => 60 * 60 * 5,
103 )
104 );
105 echo json_encode( $licenses );
106 }
107
108 wp_die();
109 }
110
111
112 /**
113 * Don't allow subsite addon licenses to be fetched
114 * unless the current user has super admin permissions
115 *
116 * @since 2.03.10
117 * @deprecated 3.04.03
118 */
119 private static function allow_autofill() {
120 $allow_autofill = FrmAppHelper::pro_is_installed();
121 if ( $allow_autofill && is_multisite() ) {
122 $sitewide_activated = get_site_option( 'frmpro-wpmu-sitewide' );
123 if ( $sitewide_activated ) {
124 $allow_autofill = current_user_can( 'setup_network' );
125 }
126 }
127 return $allow_autofill;
128 }
129
130 /**
131 * @deprecated 3.04.03
132 */
133 private static function send_api_request( $url, $transient = array() ) {
134 $data = get_transient( $transient['name'] );
135 if ( $data !== false ) {
136 return $data;
137 }
138
139 $arg_array = array(
140 'body' => array(
141 'url' => home_url(),
142 ),
143 'timeout' => 15,
144 'user-agent' => 'Formidable/' . FrmAppHelper::$plug_version . '; ' . home_url(),
145 );
146
147 $response = wp_remote_post( $url, $arg_array );
148 $body = wp_remote_retrieve_body( $response );
149 $data = false;
150 if ( ! is_wp_error( $response ) && ! is_wp_error( $body ) ) {
151 $data = json_decode( $body, true );
152 set_transient( $transient['name'], $data, $transient['expires'] );
153 }
154
155 return $data;
156 }
157
158 /**
159 * @since 3.04.03
160 * @deprecated 3.06
161 * @codeCoverageIgnore
162 */
163 public static function get_pro_updater() {
164 _deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_pro_updater' );
165 $api = new FrmFormApi();
166 return $api->get_pro_updater();
167 }
168
169 /**
170 * @since 4.06.02
171 * @deprecated 4.09.01
172 * @codeCoverageIgnore
173 */
174 public static function ajax_multiple_addons() {
175 _deprecated_function( __FUNCTION__, '4.09.01', 'FrmProAddonsController::' . __METHOD__ );
176 echo json_encode( __( 'Your plugin has been not been installed. Please update Formidable Pro to get downloads.', 'formidable' ) );
177 wp_die();
178 }
179
180 /**
181 * @since 3.04.03
182 * @deprecated 3.06
183 * @codeCoverageIgnore
184 * @return array
185 */
186 public static function error_for_license( $license ) {
187 _deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::error_for_license' );
188 $api = new FrmFormApi( $license );
189 return $api->error_for_license();
190 }
191
192 /**
193 * @since 3.04.03
194 * @deprecated 3.06
195 */
196 public static function reset_cached_addons( $license = '' ) {
197 _deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::reset_cached' );
198 $api = new FrmFormApi( $license );
199 $api->reset_cached();
200 }
201
202 /**
203 * @since 3.04.03
204 * @deprecated 3.06
205 * @return string
206 */
207 public static function get_cache_key( $license ) {
208 _deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_cache_key' );
209 $api = new FrmFormApi( $license );
210 return $api->get_cache_key();
211 }
212
213 /**
214 * @since 3.04.03
215 * @deprecated 3.06
216 * @codeCoverageIgnore
217 * @return array
218 */
219 public static function get_addon_info( $license = '' ) {
220 _deprecated_function( __FUNCTION__, '3.06', 'FrmFormApi::get_api_info' );
221 $api = new FrmFormApi( $license );
222 return $api->get_api_info();
223 }
224
225 /**
226 * Add a filter to shorten the EDD filename for Formidable plugin, and add-on, updates
227 *
228 * @since 2.03.08
229 * @deprecated 3.04.03
230 *
231 * @param bool $return
232 * @param string $package
233 *
234 * @return bool
235 */
236 public static function add_shorten_edd_filename_filter( $return, $package ) {
237 _deprecated_function( __FUNCTION__, '3.04.03' );
238
239 if ( strpos( $package, '/edd-sl/package_download/' ) !== false && strpos( $package, 'formidableforms.com' ) !== false ) {
240 add_filter( 'wp_unique_filename', 'FrmDeprecated::shorten_edd_filename', 10, 2 );
241 }
242
243 return $return;
244 }
245
246 /**
247 * Shorten the EDD filename for automatic updates
248 * Decreases size of file path so file path limit is not hit on Windows servers
249 *
250 * @since 2.03.08
251 * @deprecated 3.04.03
252 *
253 * @param string $filename
254 * @param string $ext
255 *
256 * @return string
257 */
258 public static function shorten_edd_filename( $filename, $ext ) {
259 _deprecated_function( __FUNCTION__, '3.04.03' );
260
261 $filename = substr( $filename, 0, 50 ) . $ext;
262 remove_filter( 'wp_unique_filename', 'FrmDeprecated::shorten_edd_filename', 10 );
263
264 return $filename;
265 }
266
267 /**
268 * @deprecated 3.0.04
269 */
270 public static function activation_install() {
271 _deprecated_function( __FUNCTION__, '3.0.04', 'FrmAppController::install' );
272 FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
273 FrmFormActionsController::actions_init();
274 FrmAppController::install();
275 }
276
277 /**
278 * Routes for wordpress pages -- we're just replacing content
279 *
280 * @deprecated 3.0
281 */
282 public static function page_route( $content ) {
283 _deprecated_function( __FUNCTION__, '3.0' );
284 global $post;
285
286 if ( $post && isset( $_GET['form'] ) ) {
287 $content = FrmFormsController::page_preview();
288 }
289
290 return $content;
291 }
292
293 /**
294 * @deprecated 3.0
295 */
296 public static function edit_name( $field = 'name', $id = '' ) {
297 _deprecated_function( __FUNCTION__, '3.0' );
298
299 FrmAppHelper::permission_check( 'frm_edit_forms' );
300 check_ajax_referer( 'frm_ajax', 'nonce' );
301
302 if ( empty( $field ) ) {
303 $field = 'name';
304 }
305
306 if ( empty( $id ) ) {
307 $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' );
308 $id = str_replace( 'field_label_', '', $id );
309 }
310
311 $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' );
312 $value = trim( $value );
313 if ( trim( strip_tags( $value ) ) === '' ) {
314 // set blank value if there is no content
315 $value = '';
316 }
317
318 FrmField::update( $id, array( $field => $value ) );
319
320 do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) );
321
322 echo stripslashes( wp_kses_post( $value ) );
323 wp_die();
324 }
325
326 /**
327 * Load a single field in the form builder along with all needed variables
328 *
329 * @deprecated 3.0
330 *
331 * @param int $field_id
332 * @param array $values
333 * @param int $form_id
334 *
335 * @return array
336 */
337 public static function include_single_field( $field_id, $values, $form_id = 0 ) {
338 _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldsController::load_single_field' );
339
340 $field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) );
341 FrmFieldsController::load_single_field( $field, $values, $form_id );
342
343 return $field;
344 }
345
346 /**
347 * @deprecated 3.0
348 */
349 public static function bulk_create_template( $ids ) {
350 _deprecated_function( __FUNCTION__, '3.0', 'FrmForm::duplicate( $id, true, true )' );
351 FrmAppHelper::permission_check( 'frm_edit_forms' );
352
353 foreach ( $ids as $id ) {
354 FrmForm::duplicate( $id, true, true );
355 }
356
357 return __( 'Form template was Successfully Created', 'formidable' );
358 }
359
360 /**
361 * @deprecated 3.0
362 */
363 public static function edit_key() {
364 _deprecated_function( __FUNCTION__, '3.0' );
365 $values = self::edit_in_place_value( 'form_key' );
366 echo wp_kses( stripslashes( FrmForm::get_key_by_id( $values['form_id'] ) ), array() );
367 wp_die();
368 }
369
370 /**
371 * @deprecated 3.0
372 */
373 public static function edit_description() {
374 _deprecated_function( __FUNCTION__, '3.0' );
375 $values = self::edit_in_place_value( 'description' );
376 echo wp_kses_post( FrmAppHelper::use_wpautop( stripslashes( $values['description'] ) ) );
377 wp_die();
378 }
379
380 /**
381 * @deprecated 3.0
382 */
383 private static function edit_in_place_value( $field ) {
384 _deprecated_function( __FUNCTION__, '3.0' );
385 check_ajax_referer( 'frm_ajax', 'nonce' );
386 FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
387
388 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
389 $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
390
391 $values = array( $field => trim( $value ) );
392 FrmForm::update( $form_id, $values );
393 $values['form_id'] = $form_id;
394
395 return $values;
396 }
397
398 /**
399 * @deprecated 3.0
400 *
401 * @param string $html
402 * @param array $field
403 * @param array $errors
404 * @param false|object $form
405 * @param array $args
406 *
407 * @return string
408 */
409 public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
410 _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::prepare_field_html' );
411 $field_obj = FrmFieldFactory::get_field_type( $field['type'], $field );
412 return $field_obj->prepare_field_html( compact( 'errors', 'form' ) );
413 }
414
415 /**
416 * @deprecated 3.0
417 */
418 public static function get_default_field_opts( $type, $field = null, $limit = false ) {
419 if ( $limit ) {
420 _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options' );
421 $field_options = FrmFieldsHelper::get_default_field_options( $type );
422 } else {
423 _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field' );
424 $field_options = FrmFieldsHelper::get_default_field( $type );
425 }
426
427 return $field_options;
428 }
429
430 /**
431 * @deprecated 3.0
432 */
433 public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
434 _deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::remove_inline_conditions' );
435 FrmShortcodeHelper::remove_inline_conditions( $no_vars, $code, $replace_with, $html );
436 }
437
438 /**
439 * @deprecated 3.0
440 */
441 public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
442 _deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' );
443 return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
444 }
445
446 /**
447 * @deprecated 3.01
448 */
449 public static function get_sigle_label_postitions() {
450 _deprecated_function( __FUNCTION__, '3.01', 'FrmStylesHelper::get_single_label_positions' );
451 return FrmStylesHelper::get_single_label_positions();
452 }
453
454 /**
455 * @deprecated 3.02.03
456 */
457 public static function jquery_themes() {
458 _deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_themes' );
459
460 $themes = array(
461 'ui-lightness' => 'UI Lightness',
462 'ui-darkness' => 'UI Darkness',
463 'smoothness' => 'Smoothness',
464 'start' => 'Start',
465 'redmond' => 'Redmond',
466 'sunny' => 'Sunny',
467 'overcast' => 'Overcast',
468 'le-frog' => 'Le Frog',
469 'flick' => 'Flick',
470 'pepper-grinder' => 'Pepper Grinder',
471 'eggplant' => 'Eggplant',
472 'dark-hive' => 'Dark Hive',
473 'cupertino' => 'Cupertino',
474 'south-street' => 'South Street',
475 'blitzer' => 'Blitzer',
476 'humanity' => 'Humanity',
477 'hot-sneaks' => 'Hot Sneaks',
478 'excite-bike' => 'Excite Bike',
479 'vader' => 'Vader',
480 'dot-luv' => 'Dot Luv',
481 'mint-choc' => 'Mint Choc',
482 'black-tie' => 'Black Tie',
483 'trontastic' => 'Trontastic',
484 'swanky-purse' => 'Swanky Purse',
485 );
486
487 $themes = apply_filters( 'frm_jquery_themes', $themes );
488 return $themes;
489 }
490
491 /**
492 * @deprecated 3.02.03
493 */
494 public static function enqueue_jquery_css() {
495 _deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::enqueue_jquery_css' );
496
497 $form = self::get_form_for_page();
498 $theme_css = FrmStylesController::get_style_val( 'theme_css', $form );
499 if ( $theme_css != -1 ) {
500 wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() );
501 }
502 }
503
504 /**
505 * @deprecated 3.02.03
506 */
507 public static function jquery_css_url( $theme_css ) {
508 _deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_css_url' );
509
510 if ( ! is_callable( 'FrmProStylesController::jquery_css_url' ) ) {
511 return;
512 }
513
514 return FrmProStylesController::jquery_css_url( $theme_css );
515 }
516
517 /**
518 * @deprecated 3.02.03
519 */
520 public static function get_form_for_page() {
521 _deprecated_function( __FUNCTION__, '3.02.03' );
522
523 global $frm_vars;
524 $form_id = 'default';
525 if ( ! empty( $frm_vars['forms_loaded'] ) ) {
526 foreach ( $frm_vars['forms_loaded'] as $form ) {
527 if ( is_object( $form ) ) {
528 $form_id = $form->id;
529 break;
530 }
531 }
532 }
533 return $form_id;
534 }
535
536 /**
537 * @deprecated 2.02.07
538 */
539 public static function dropdown_categories( $args ) {
540 _deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' );
541
542 if ( FrmAppHelper::pro_is_installed() ) {
543 $args['location'] = 'front';
544 $dropdown = FrmProPost::get_category_dropdown( $args['field'], $args );
545 } else {
546 $dropdown = '';
547 }
548
549 return $dropdown;
550 }
551 }
552