PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
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
← All changes | classes/controllers/FrmFormsController.php +475 -366 6.5.26.10 View file →
@@ -54,9 +54,9 @@
54 54 */
55 55 public static function logic_tip() {
56 56 $images_url = FrmAppHelper::plugin_url() . '/images/';
57 57 $data_message = __( 'Only show the fields you need and create branching forms. Upgrade to get conditional logic and question branching.', 'formidable' );
58 - $data_message .= ' <img src="' . esc_attr( $images_url ) . '/survey-logic.png" srcset="' . esc_attr( $images_url ) . 'survey-logic@2x.png 2x" alt="' . esc_attr__( 'Conditional Logic options', 'formidable' ) . '"/>';
58 + $data_message .= ' <img src="' . esc_url( $images_url ) . '/survey-logic.png" srcset="' . esc_url( $images_url ) . 'survey-logic@2x.png 2x" alt="' . esc_attr__( 'Conditional Logic options', 'formidable' ) . '"/>';
59 59 echo '<a href="javascript:void(0)" class="frm_noallow frm_show_upgrade frm_add_logic_link frm-collapsed frm-flex-justify" data-upgrade="' . esc_attr__( 'Conditional Logic options', 'formidable' ) . '" data-message="' . esc_attr( $data_message ) . '" data-medium="builder" data-content="logic">';
60 60 esc_html_e( 'Conditional Logic', 'formidable' );
61 61 FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) );
62 62 echo '</a>';
@@ -96,9 +96,9 @@
96 96 * Create the default email action
97 97 *
98 98 * @since 2.02.11
99 99 *
100 - * @param object|int $form
100 + * @param int|object $form
101 101 */
102 102 private static function create_default_email_action( $form ) {
103 103 FrmForm::maybe_get_form( $form );
104 104 $create_email = apply_filters( 'frm_create_default_email_action', true, $form );
@@ -113,9 +113,9 @@
113 113 * Create the default On submit action
114 114 *
115 115 * @since 6.0.0
116 116 *
117 - * @param object|int $form Form object or ID.
117 + * @param int|object $form Form object or ID.
118 118 */
119 119 private static function create_default_on_submit_action( $form ) {
120 120 FrmForm::maybe_get_form( $form );
121 121
@@ -134,16 +134,53 @@
134 134 $action_control->create( $form->id );
135 135 }
136 136 }
137 137
138 + /**
139 + * Creates submit button field.
140 + *
141 + * @since 6.9
142 + *
143 + * @param int|object $form Form ID or object.
144 + */
145 + private static function create_submit_button_field( $form ) {
146 + FrmForm::maybe_get_form( $form );
147 +
148 + if ( FrmSubmitHelper::get_submit_field( $form->id ) ) {
149 + // Do not create submit button field if it exists.
150 + return;
151 + }
152 +
153 + FrmField::create(
154 + array(
155 + 'type' => FrmSubmitHelper::FIELD_TYPE,
156 + 'name' => __( 'Submit', 'formidable' ),
157 + 'field_order' => 9999,
158 + 'form_id' => $form->id,
159 + 'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ),
160 + 'description' => '',
161 + 'default_value' => '',
162 + 'options' => array(),
163 + )
164 + );
165 + }
166 +
167 + /**
168 + * @return void
169 + */
138 170 public static function edit( $values = false ) {
139 171 FrmAppHelper::permission_check( 'frm_edit_forms' );
140 172
141 173 $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
142 174
143 - return self::get_edit_vars( $id );
175 + self::get_edit_vars( $id );
144 176 }
145 177
178 + /**
179 + * @param mixed $id
180 + * @param string $message
181 + * @return void
182 + */
146 183 public static function settings( $id = false, $message = '' ) {
147 184 FrmAppHelper::permission_check( 'frm_edit_forms' );
148 185
149 186 if ( ! $id || ! is_numeric( $id ) ) {
@@ -151,21 +188,34 @@
151 188 }
152 189
153 190 FrmOnSubmitHelper::maybe_migrate_submit_settings_to_action( $id );
154 191
155 - return self::get_settings_vars( $id, array(), $message );
192 + self::get_settings_vars( $id, array(), $message );
156 193 }
157 194
158 195 public static function update_settings() {
159 196 FrmAppHelper::permission_check( 'frm_edit_forms' );
197 + $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
160 198
199 + if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
200 + $frm_settings = FrmAppHelper::get_settings();
201 + $error_args = array(
202 + 'title' => __( 'Verification failed', 'formidable' ),
203 + 'body' => $frm_settings->admin_permission,
204 + 'cancel_text' => __( 'Cancel', 'formidable' ),
205 + );
206 + FrmAppController::show_error_modal( $error_args );
207 + return;
208 + }
209 +
161 210 $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
162 211
163 - $errors = FrmForm::validate( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
212 + $errors = FrmForm::validate( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
164 213 $warnings = FrmFormsHelper::check_for_warnings( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
165 214
166 215 if ( count( $errors ) > 0 ) {
167 - return self::get_settings_vars( $id, $errors, compact( 'warnings' ) );
216 + self::get_settings_vars( $id, $errors, compact( 'warnings' ) );
217 + return;
168 218 }
169 219
170 220 do_action( 'frm_before_update_form_settings', $id );
171 221
@@ -179,9 +229,9 @@
179 229 }
180 230
181 231 $message = __( 'Settings Successfully Updated', 'formidable' );
182 232
183 - return self::get_settings_vars( $id, array(), compact( 'message', 'warnings' ) );
233 + self::get_settings_vars( $id, array(), compact( 'message', 'warnings' ) );
184 234 }
185 235
186 236 /**
187 237 * @param int $form_id
@@ -191,8 +241,11 @@
191 241 $form = FrmForm::getOne( $form_id );
192 242 return ! empty( $form->options['antispam'] );
193 243 }
194 244
245 + /**
246 + * @return void
247 + */
195 248 public static function update( $values = array() ) {
196 249 if ( empty( $values ) ) {
197 250 $values = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing
198 251 }
@@ -210,65 +263,74 @@
210 263
211 264 $id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
212 265
213 266 if ( count( $errors ) > 0 ) {
214 - return self::get_edit_vars( $id, $errors );
215 - } else {
216 - FrmForm::update( $id, $values );
217 - $message = __( 'Form was successfully updated.', 'formidable' );
267 + self::get_edit_vars( $id, $errors );
268 + return;
269 + }
218 270
219 - if ( self::is_too_long( $values ) ) {
220 - $message .= '<br/> ' . sprintf(
221 - /* translators: %1$s: Start link HTML, %2$s: end link HTML */
222 - __( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ),
223 - '<a href="https://formidableforms.com/knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/?utm_source=WordPress&utm_medium=builder&utm_campaign=liteplugin" target="_blank" rel="noopener">',
224 - '</a>'
225 - );
226 - }
271 + self::maybe_remove_draft_option_from_fields( $id );
227 272
228 - if ( defined( 'DOING_AJAX' ) ) {
229 - wp_die( FrmAppHelper::kses( $message, array( 'a' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
230 - }
273 + FrmForm::update( $id, $values );
274 + $message = __( 'Form was successfully updated.', 'formidable' );
231 275
232 - return self::get_edit_vars( $id, array(), $message );
276 + if ( self::is_too_long( $values ) ) {
277 + $message .= '<br/> ' . sprintf(
278 + /* translators: %1$s: Start link HTML, %2$s: end link HTML */
279 + __( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ),
280 + '<a href="https://formidableforms.com/knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/?utm_source=WordPress&utm_medium=builder&utm_campaign=liteplugin" target="_blank" rel="noopener">',
281 + '</a>'
282 + );
233 283 }
284 +
285 + if ( defined( 'DOING_AJAX' ) ) {
286 + wp_die( FrmAppHelper::kses( $message, array( 'a' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
287 + }
288 +
289 + self::get_edit_vars( $id, array(), $message );
234 290 }
235 291
236 292 /**
293 + * Remove the draft flag from any new fields from this current session.
294 + *
295 + * @since 6.8
296 + *
297 + * @param int $form_id
298 + * @return void
299 + */
300 + private static function maybe_remove_draft_option_from_fields( $form_id ) {
301 + $draft_field_ids_csv = FrmAppHelper::get_post_param( 'draft_fields', '', 'sanitize_text_field' );
302 + if ( ! $draft_field_ids_csv ) {
303 + // If the draft_fields input is empty there are no new fields in the session.
304 + return;
305 + }
306 +
307 + $draft_field_ids = array_filter( explode( ',', $draft_field_ids_csv ), 'is_numeric' );
308 + if ( ! $draft_field_ids ) {
309 + // Exit early if the draft fields input is invalid. It should be a CSV of integer values.
310 + return;
311 + }
312 +
313 + $draft_field_rows = FrmFieldsHelper::get_draft_field_results( $form_id, $draft_field_ids );
314 + foreach ( $draft_field_rows as $row ) {
315 + $row->field_options['draft'] = 0;
316 + FrmField::update( $row->id, array( 'field_options' => $row->field_options ) );
317 + }
318 + }
319 +
320 + /**
237 321 * Check if the value at the end of the form was included.
238 322 * If it's missing, it means other values at the end of the form
239 323 * were likely not saved either.
240 324 *
241 325 * @since 3.06.01
326 + *
327 + * @return bool
242 328 */
243 329 private static function is_too_long( $values ) {
244 - return ( ! isset( $values['frm_end'] ) ) || empty( $values['frm_end'] );
330 + return empty( $values['frm_end'] );
245 331 }
246 332
247 - /**
248 - * Redirect to the url for creating from a template
249 - * Also delete the current form
250 - *
251 - * @since 2.0
252 - * @deprecated 3.06
253 - */
254 - public static function _create_from_template() {
255 - _deprecated_function( __FUNCTION__, '3.06' );
256 -
257 - FrmAppHelper::permission_check( 'frm_edit_forms' );
258 - check_ajax_referer( 'frm_ajax', 'nonce' );
259 -
260 - $current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
261 - $template_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
262 -
263 - if ( $current_form ) {
264 - FrmForm::destroy( $current_form );
265 - }
266 -
267 - echo esc_url_raw( admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . absint( $template_id ) ) );
268 - wp_die();
269 - }
270 -
271 333 public static function duplicate() {
272 334 FrmAppHelper::permission_check( 'frm_edit_forms' );
273 335 $nonce = FrmAppHelper::simple_get( '_wpnonce' );
274 336
@@ -282,10 +344,11 @@
282 344 $url = admin_url( 'admin.php?page=formidable' );
283 345 $message = 'form_duplicate_error';
284 346
285 347 if ( $form ) {
286 - $url = admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $form ) );
287 - $message = 'form_duplicated';
348 + $new_template = FrmAppHelper::simple_get( 'new_template' ) ? '&new_template=true' : '';
349 + $url = admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $form ) . $new_template );
350 + $message = 'form_duplicated';
288 351 }
289 352
290 353 $url .= '&message=' . $message;
291 354
@@ -293,24 +356,28 @@
293 356 exit();
294 357 }
295 358
296 359 /**
297 - * @return string
360 + * @return string|null
298 361 */
299 362 public static function page_preview() {
300 363 $params = FrmForm::list_page_params();
301 364 if ( ! $params['form'] ) {
302 - return;
365 + return null;
303 366 }
304 367
305 368 $form = FrmForm::getOne( $params['form'] );
306 - if ( $form ) {
307 - return self::show_form( $form->id, '', 'auto', 'auto' );
369 + if ( ! $form ) {
370 + return null;
308 371 }
372 +
373 + return self::show_form( $form->id, '', 'auto', 'auto' );
309 374 }
310 375
311 376 /**
312 377 * @since 3.0
378 + *
379 + * @return void
313 380 */
314 381 public static function show_page_preview() {
315 382 echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
316 383 }
@@ -360,8 +427,13 @@
360 427 return;
361 428 }
362 429
363 430 $random_page = reset( $random_page );
431 + if ( ! is_a( $random_page, 'WP_Post' ) ) {
432 + // The return type can also be int.
433 + return;
434 + }
435 +
364 436 query_posts(
365 437 array(
366 438 'post_type' => 'page',
367 439 'page_id' => $random_page->ID,
@@ -377,9 +449,9 @@
377 449 * Set the WP $post global object. Used for in-theme preview when defining a page.
378 450 *
379 451 * @since 5.5.2
380 452 *
381 - * @param WP_Post $post
453 + * @param WP_Post $page The page object.
382 454 * @return void
383 455 */
384 456 private static function set_post_global( $page ) {
385 457 global $post;
@@ -387,8 +459,10 @@
387 459 }
388 460
389 461 /**
390 462 * @since 3.0
463 + *
464 + * @return void
391 465 */
392 466 private static function load_theme_preview() {
393 467 add_filter( 'wp_title', 'FrmFormsController::preview_title', 9999 );
394 468 add_filter( 'the_title', 'FrmFormsController::preview_page_title', 9999 );
@@ -397,20 +471,39 @@
397 471 add_filter( 'is_active_sidebar', '__return_false' );
398 472 FrmStylesController::enqueue_css( 'enqueue', true );
399 473
400 474 if ( false === get_template_part( 'page' ) ) {
475 + if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) {
476 + add_filter( 'body_class', 'FrmFormsController::preview_block_theme_body_classnames' );
477 + }
401 478 self::fallback_when_page_template_part_is_not_supported_by_theme();
402 479 }
403 480 }
404 481
405 482 /**
483 + * Add padding to the body for block themes.
484 + *
485 + * @since 6.5.2
486 + *
487 + * @param array $classes The body classes list.
488 + * @return array
489 + */
490 + public static function preview_block_theme_body_classnames( $classes ) {
491 + $classes[] = 'has-global-padding';
492 + return $classes;
493 + }
494 +
495 + /**
406 496 * Not every theme supports get_template_part( 'page' ).
407 497 * When this is not supported, false is returned, and we can handle a fallback.
498 + *
499 + * @return void
408 500 */
409 501 private static function fallback_when_page_template_part_is_not_supported_by_theme() {
410 502 if ( have_posts() ) {
411 503 the_post();
412 - get_header( '' );
504 + self::get_template( 'header' );
505 +
413 506 // add some generic class names to the container to add some natural padding to the content.
414 507 // .entry-content catches the WordPress TwentyTwenty theme.
415 508 // .container catches Customizr content.
416 509 echo '<div class="container entry-content">';
@@ -415,13 +508,54 @@
415 508 // .container catches Customizr content.
416 509 echo '<div class="container entry-content">';
417 510 the_content();
418 511 echo '</div>';
419 - get_footer();
512 +
513 + self::get_template( 'footer' );
420 514 }
421 515 }
422 516
423 517 /**
518 + * Calls core function to get a template part if it doesn't cause deprecation warnings. Otherwise skips the deprecation function call
519 + * and renders required html fragements calling required functions.
520 + *
521 + * @since 6.7.1
522 + * @param string $template
523 + * @return void
524 + */
525 + private static function get_template( $template ) {
526 + if ( self::should_try_getting_template( $template ) ) {
527 + call_user_func( 'get_' . $template );
528 + return;
529 + }
530 +
531 + if ( 'header' === $template ) {
532 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/header.php';
533 + return;
534 + }
535 +
536 + if ( 'footer' === $template ) {
537 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/footer.php';
538 + }
539 + }
540 +
541 + /**
542 + * Returns true if calling a template function doesn't trigger deprecation warnings.
543 + *
544 + * @since 6.7.1
545 + * @param string $template
546 + * @return bool
547 + */
548 + private static function should_try_getting_template( $template ) {
549 + $stylesheet_path = get_stylesheet_directory();
550 + $template_path = get_template_directory();
551 + $is_child_theme = $stylesheet_path !== $template_path;
552 + $template_name = $template . '.php';
553 +
554 + return file_exists( $stylesheet_path . '/' . $template_name ) || $is_child_theme && file_exists( $template_path . '/' . $template_name );
555 + }
556 +
557 + /**
424 558 * Set the page title for the theme preview page
425 559 *
426 560 * @since 3.0
427 561 */
@@ -433,11 +567,14 @@
433 567 return $title;
434 568 }
435 569
436 570 /**
437 - * Set the page title for the theme preview page
571 + * Set the page title for the theme preview page.
438 572 *
439 573 * @since 3.0
574 + *
575 + * @param string $title
576 + * @return string
440 577 */
441 578 public static function preview_title( $title ) {
442 579 return __( 'Form Preview', 'formidable' );
443 580 }
@@ -442,15 +579,20 @@
442 579 return __( 'Form Preview', 'formidable' );
443 580 }
444 581
445 582 /**
446 - * Set the page content for the theme preview page
583 + * Set the page content for the theme preview page.
447 584 *
448 585 * @since 3.0
586 + *
587 + * @param string $content
588 + * @return string
449 589 */
450 590 public static function preview_content( $content ) {
451 591 if ( in_the_loop() ) {
452 - $content = self::show_page_preview();
592 + self::show_page_preview();
593 + // Clear the content for the page we're using.
594 + $content = '';
453 595 }
454 596
455 597 return $content;
456 598 }
@@ -460,8 +602,11 @@
460 602 */
461 603 private static function load_direct_preview() {
462 604 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
463 605
606 + // print_emoji_styles is deprecated.
607 + remove_action( 'wp_print_styles', 'print_emoji_styles' );
608 +
464 609 $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
465 610 if ( $key == '' ) {
466 611 $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
467 612 }
@@ -470,11 +615,38 @@
470 615 if ( empty( $form ) ) {
471 616 $form = FrmForm::getAll( array(), '', 1 );
472 617 }
473 618
474 - require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
619 + self::fix_deprecated_null_param_warning();
620 +
621 + require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
475 622 }
476 623
624 + /**
625 + * Some themes have a null $src value.
626 + * This function adds a filter to ensure that $src is not null.
627 + * WP will call str_starts_with with the null value triggering a deprecated message otherwise.
628 + *
629 + * @since 6.10
630 + *
631 + * @return void
632 + */
633 + private static function fix_deprecated_null_param_warning() {
634 + add_filter(
635 + 'script_loader_src',
636 + /**
637 + * @param string|null $src
638 + * @return string
639 + */
640 + function ( $src ) {
641 + if ( is_null( $src ) ) {
642 + $src = '';
643 + }
644 + return $src;
645 + }
646 + );
647 + }
648 +
477 649 public static function untrash() {
478 650 self::change_form_status( 'untrash' );
479 651 }
480 652
@@ -537,14 +709,14 @@
537 709 FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
538 710
539 711 $params = FrmForm::list_page_params();
540 712
541 - //check nonce url
713 + // Check nonce url.
542 714 check_admin_referer( $status . '_form_' . $params['id'] );
543 715
544 716 $count = 0;
545 717 if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
546 - $count ++;
718 + ++$count;
547 719 }
548 720
549 721 $form_type = FrmAppHelper::get_simple_request(
550 722 array(
@@ -556,9 +728,9 @@
556 728 /* translators: %1$s: Number of forms */
557 729 $available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
558 730
559 731 /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
560 - $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
732 + $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
561 733
562 734 $message = $available_status[ $status ]['message'];
563 735
564 736 self::display_forms_list( $params, $message );
@@ -563,8 +735,12 @@
563 735
564 736 self::display_forms_list( $params, $message );
565 737 }
566 738
739 + /**
740 + * @param array $ids
741 + * @return string
742 + */
567 743 public static function bulk_trash( $ids ) {
568 744 FrmAppHelper::permission_check( 'frm_delete_forms' );
569 745
570 746 $count = 0;
@@ -569,9 +745,9 @@
569 745
570 746 $count = 0;
571 747 foreach ( $ids as $id ) {
572 748 if ( FrmForm::trash( $id ) ) {
573 - $count ++;
749 + ++$count;
574 750 }
575 751 }
576 752
577 753 $current_page = FrmAppHelper::get_simple_request(
@@ -600,9 +776,9 @@
600 776 check_admin_referer( 'destroy_form_' . $params['id'] );
601 777
602 778 $count = 0;
603 779 if ( FrmForm::destroy( $params['id'] ) ) {
604 - $count ++;
780 + ++$count;
605 781 }
606 782
607 783 /* translators: %1$s: Number of forms */
608 784 $message = sprintf( _n( '%1$s Form Permanently Deleted', '%1$s Forms Permanently Deleted', $count, 'formidable' ), $count );
@@ -609,8 +785,12 @@
609 785
610 786 self::display_forms_list( $params, $message );
611 787 }
612 788
789 + /**
790 + * @param array $ids
791 + * @return string
792 + */
613 793 public static function bulk_destroy( $ids ) {
614 794 FrmAppHelper::permission_check( 'frm_delete_forms' );
615 795
616 796 $count = 0;
@@ -616,19 +796,24 @@
616 796 $count = 0;
617 797 foreach ( $ids as $id ) {
618 798 $d = FrmForm::destroy( $id );
619 799 if ( $d ) {
620 - $count ++;
800 + ++$count;
621 801 }
622 802 }
623 803
624 - /* translators: %1$s: Number of forms */
625 - $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
804 + if ( $count ) {
805 + /* translators: %1$s: Number of forms */
806 + return sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
807 + }
626 808
627 - return $message;
809 + return '';
628 810 }
629 811
630 - private static function delete_all() {
812 + /**
813 + * @since 6.7.1 Function went from private to public.
814 + */
815 + public static function delete_all() {
631 816 // Check nonce url.
632 817 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
633 818 if ( $permission_error !== false ) {
634 819 self::display_forms_list( array(), '', array( $permission_error ) );
@@ -635,14 +820,15 @@
635 820
636 821 return;
637 822 }
638 823
639 - $count = FrmForm::scheduled_delete( time() );
824 + $count = FrmForm::scheduled_delete( time() );
825 + $url = remove_query_arg( array( 'delete_all' ) );
640 826
641 - /* translators: %1$s: Number of forms */
642 - $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
827 + $url .= '&message=forms_permanently_deleted&forms_deleted=' . $count;
643 828
644 - self::display_forms_list( array(), $message );
829 + wp_safe_redirect( $url );
830 + die();
645 831 }
646 832
647 833 /**
648 834 * Create a new form from the modal.
@@ -655,9 +841,9 @@
655 841
656 842 $new_values = self::get_modal_values();
657 843 $new_values['form_key'] = $new_values['name'];
658 844 $new_values['options'] = array(
659 - 'antispam' => 1,
845 + 'antispam' => 1,
660 846 'on_submit_migrated' => 1,
661 847 );
662 848
663 849 /**
@@ -676,13 +862,14 @@
676 862 * @param int $form_id
677 863 */
678 864 do_action( 'frm_build_new_form', $form_id );
679 865
866 + self::create_submit_button_field( $form_id );
680 867 self::create_default_on_submit_action( $form_id );
681 868 self::create_default_email_action( $form_id );
682 869
683 870 $response = array(
684 - 'redirect' => FrmForm::get_edit_link( $form_id ),
871 + 'redirect' => FrmForm::get_edit_link( $form_id ) . '&new_template=true',
685 872 );
686 873
687 874 echo wp_json_encode( $response );
688 875 wp_die();
@@ -688,46 +875,15 @@
688 875 wp_die();
689 876 }
690 877
691 878 /**
692 - * Create a custom template from a form
693 - *
694 - * @since 3.06
695 - */
696 - public static function build_template() {
697 - global $wpdb;
698 -
699 - FrmAppHelper::permission_check( 'frm_edit_forms' );
700 - check_ajax_referer( 'frm_ajax', 'nonce' );
701 -
702 - $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
703 - $new_form_id = FrmForm::duplicate( $form_id, 1, true );
704 - if ( ! $new_form_id ) {
705 - $response = array(
706 - 'message' => __( 'There was an error creating a template.', 'formidable' ),
707 - );
708 - } else {
709 - $new_values = self::get_modal_values();
710 - $query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', $new_values, array( 'id' => $new_form_id ) );
711 - if ( $query_results ) {
712 - FrmForm::clear_form_cache();
713 - }
714 -
715 - $response = array(
716 - 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . $new_form_id ) . '&_wpnonce=' . wp_create_nonce(),
717 - );
718 - }
719 -
720 - echo wp_json_encode( $response );
721 - wp_die();
722 - }
723 -
724 - /**
725 879 * Before creating a new form, get the name and description from the modal.
726 880 *
727 881 * @since 4.0
882 + *
883 + * @return array<string,string>
728 884 */
729 - private static function get_modal_values() {
885 + public static function get_modal_values() {
730 886 $name = FrmAppHelper::get_param( 'name', '', 'post', 'sanitize_text_field' );
731 887 $desc = FrmAppHelper::get_param( 'desc', '', 'post', 'sanitize_textarea_field' );
732 888
733 889 return array(
@@ -740,8 +896,10 @@
740 896 * Inserts Formidable button
741 897 * Hook exists since 2.5.0
742 898 *
743 899 * @since 2.0.15
900 + *
901 + * @return void
744 902 */
745 903 public static function insert_form_button() {
746 904 if ( current_user_can( 'frm_view_forms' ) ) {
747 905 FrmAppHelper::load_admin_wide_js();
@@ -838,9 +996,9 @@
838 996 $form_id = $opts['form_id'];
839 997 unset( $opts['form_id'] );
840 998 }
841 999
842 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
1000 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php';
843 1001
844 1002 echo '</div>';
845 1003
846 1004 wp_die();
@@ -908,8 +1066,11 @@
908 1066
909 1067 return $columns;
910 1068 }
911 1069
1070 + /**
1071 + * @return array<string,string>
1072 + */
912 1073 public static function get_sortable_columns() {
913 1074 return array(
914 1075 'id' => 'id',
915 1076 'name' => 'name',
@@ -943,9 +1104,9 @@
943 1104 return $hidden_columns;
944 1105 }
945 1106
946 1107 public static function save_per_page( $save, $option, $value ) {
947 - if ( $option == 'formidable_page_formidable_per_page' ) {
1108 + if ( $option === 'formidable_page_formidable_per_page' ) {
948 1109 $save = (int) $value;
949 1110 }
950 1111
951 1112 return $save;
@@ -951,146 +1112,49 @@
951 1112 return $save;
952 1113 }
953 1114
954 1115 /**
955 - * @return bool
956 - */
957 - public static function expired() {
958 - global $frm_expired;
959 - return $frm_expired;
960 - }
961 -
962 - /**
963 - * Get data from api before rendering it so that we can flag the modal as expired
964 - *
1116 + * @param int|string $id
1117 + * @param array $errors
1118 + * @param string $message
1119 + * @param bool $create_link
965 1120 * @return void
966 1121 */
967 - public static function before_list_templates() {
968 - global $frm_templates;
969 - global $frm_expired;
970 - global $frm_license_type;
1122 + private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1123 + global $frm_vars;
971 1124
972 - $api = new FrmFormTemplateApi();
973 - $frm_templates = $api->get_api_info();
974 - $expired = false;
975 - $license_type = '';
976 - if ( isset( $frm_templates['error'] ) ) {
977 - $error = $frm_templates['error']['message'];
978 - $error = str_replace( 'utm_medium=addons', 'utm_medium=form-templates', $error );
979 - $expired = 'expired' === $frm_templates['error']['code'];
980 - $license_type = isset( $frm_templates['error']['type'] ) ? $frm_templates['error']['type'] : '';
981 - unset( $frm_templates['error'] );
982 - }
983 -
984 - $frm_expired = $expired;
985 - $frm_license_type = $license_type;
986 - }
987 -
988 - /**
989 - * @return void
990 - */
991 - public static function list_templates() {
992 - global $frm_templates;
993 - global $frm_license_type;
994 -
995 - $templates = $frm_templates;
996 - $custom_templates = array();
997 - $templates_by_category = array();
998 -
999 - self::add_user_templates( $custom_templates );
1000 -
1001 - foreach ( $templates as $template ) {
1002 - if ( ! isset( $template['categories'] ) ) {
1003 - continue;
1004 - }
1005 -
1006 - foreach ( $template['categories'] as $category ) {
1007 - if ( ! isset( $templates_by_category[ $category ] ) ) {
1008 - $templates_by_category[ $category ] = array();
1009 - }
1010 -
1011 - $templates_by_category[ $category ][] = $template;
1012 - }
1013 - }
1014 - unset( $template );
1015 -
1016 - // Subcategories that are included elsewhere.
1017 - $redundant_cats = array( 'PayPal', 'Stripe', 'Twilio' );
1018 -
1019 - $categories = array_keys( $templates_by_category );
1020 - $categories = array_diff( $categories, FrmFormsHelper::ignore_template_categories() );
1021 - $categories = array_diff( $categories, $redundant_cats );
1022 - sort( $categories );
1023 -
1024 - array_walk(
1025 - $custom_templates,
1026 - function( &$template ) {
1027 - $template['custom'] = true;
1028 - }
1125 + $form = FrmForm::getOne( $id );
1126 + $error_args = array(
1127 + 'title' => __( 'You can\'t edit the form', 'formidable' ),
1128 + 'body' => __( 'You are trying to edit a form that does not exist', 'formidable' ),
1129 + 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
1130 + 'continue_url' => add_query_arg(
1131 + array(
1132 + 'page' => 'formidable',
1133 + )
1134 + ),
1029 1135 );
1030 -
1031 - $my_templates_translation = __( 'My Templates', 'formidable' );
1032 - $categories = array_merge( array( $my_templates_translation ), $categories );
1033 - $pricing = FrmAppHelper::admin_upgrade_link( 'form-templates' );
1034 - $license_type = $frm_license_type;
1035 - $args = compact( 'pricing', 'license_type' );
1036 - $where = apply_filters( 'frm_forms_dropdown', array(), '' );
1037 - $forms = FrmForm::get_published_forms( $where );
1038 - $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
1039 -
1040 - $templates_by_category[ $my_templates_translation ] = $custom_templates;
1041 -
1042 - unset( $pricing, $license_type, $where );
1043 - wp_enqueue_script( 'accordion' ); // register accordion for template groups
1044 - require $view_path . 'list-templates.php';
1045 - }
1046 -
1047 - /**
1048 - * @since 4.03.01
1049 - */
1050 - private static function get_template_categories( $templates ) {
1051 - $categories = array();
1052 - foreach ( $templates as $template ) {
1053 - if ( isset( $template['categories'] ) ) {
1054 - $categories = array_merge( $categories, $template['categories'] );
1055 - }
1136 + if ( ! $form ) {
1137 + FrmAppController::show_error_modal( $error_args );
1138 + return;
1056 1139 }
1057 - $exclude_cats = FrmFormsHelper::ignore_template_categories();
1058 - $categories = array_unique( $categories );
1059 - $categories = array_diff( $categories, $exclude_cats );
1060 - sort( $categories );
1061 - return $categories;
1062 - }
1063 1140
1064 - private static function add_user_templates( &$templates ) {
1065 - $user_templates = array(
1066 - 'is_template' => 1,
1067 - 'default_template' => 0,
1068 - );
1069 - $user_templates = FrmForm::getAll( $user_templates, 'name' );
1070 - foreach ( $user_templates as $template ) {
1071 - $template = array(
1072 - 'id' => $template->id,
1073 - 'name' => $template->name,
1074 - 'key' => $template->form_key,
1075 - 'description' => $template->description,
1076 - 'url' => wp_nonce_url( admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . absint( $template->id ) ) ),
1077 - 'released' => $template->created_at,
1078 - 'installed' => 1,
1141 + if ( 'trash' === $form->status ) {
1142 + $error_args['body'] = __( 'The form you\'re trying to edit is in trash. You must restore it first before you can make changes', 'formidable' );
1143 + $error_args['continue_url'] = add_query_arg(
1144 + array(
1145 + 'page' => 'formidable',
1146 + '_wpnonce' => wp_create_nonce( 'untrash_form_' . $id ),
1147 + 'form_type' => 'trash',
1148 + 'frm_action' => 'untrash',
1149 + 'id' => $id,
1150 + )
1079 1151 );
1080 - array_unshift( $templates, $template );
1081 - unset( $template );
1152 + $error_args['continue_text'] = __( 'Restore form', 'formidable' );
1153 + FrmAppController::show_error_modal( $error_args );
1154 + return;
1082 1155 }
1083 - }
1084 1156
1085 - private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1086 - global $frm_vars;
1087 -
1088 - $form = FrmForm::getOne( $id );
1089 - if ( ! $form ) {
1090 - wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
1091 - }
1092 -
1093 1157 if ( $form->parent_form_id ) {
1094 1158 /* translators: %1$s: Start link HTML, %2$s: End link HTML */
1095 1159 wp_die( sprintf( esc_html__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( FrmForm::get_edit_link( $form->parent_form_id ) ) . '">', '</a>' ) );
1096 1160 }
@@ -1101,8 +1165,9 @@
1101 1165
1102 1166 // Automatically add end section fields if they don't exist (2.0 migration).
1103 1167 $reset_fields = false;
1104 1168 FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
1169 + FrmSubmitHelper::maybe_create_submit_field( $form, $fields, $reset_fields );
1105 1170
1106 1171 if ( $reset_fields ) {
1107 1172 $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
1108 1173 }
@@ -1129,17 +1194,21 @@
1129 1194
1130 1195 self::maybe_update_form_builder_message( $message );
1131 1196
1132 1197 $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
1133 - $has_fields = isset( $values['fields'] ) && ! empty( $values['fields'] );
1198 + $has_fields = ! empty( $values['fields'] ) && ! FrmSubmitHelper::only_contains_submit_field( $values['fields'] );
1134 1199
1135 1200 if ( defined( 'DOING_AJAX' ) ) {
1136 1201 wp_die();
1137 - } else {
1138 - require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
1139 1202 }
1203 +
1204 + require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php';
1140 1205 }
1141 1206
1207 + /**
1208 + * @param array $fields
1209 + * @return array
1210 + */
1142 1211 public static function update_form_builder_fields( $fields, $form ) {
1143 1212 foreach ( $fields as $field ) {
1144 1213 $field->do_not_include_icons = true;
1145 1214 }
@@ -1151,13 +1220,21 @@
1151 1220 $message = __( 'Form was Successfully Copied', 'formidable' );
1152 1221 }
1153 1222 }
1154 1223
1224 + /**
1225 + * @param int|string $id
1226 + * @param array $errors
1227 + * @param array|string $args
1228 + * @return void
1229 + */
1155 1230 public static function get_settings_vars( $id, $errors = array(), $args = array() ) {
1156 1231 FrmAppHelper::permission_check( 'frm_edit_forms' );
1157 1232
1158 1233 global $frm_vars;
1159 1234
1235 + self::maybe_print_media_templates();
1236 +
1160 1237 if ( ! is_array( $args ) ) {
1161 1238 // For reverse compatibility.
1162 1239 $args = array(
1163 1240 'message' => $args,
@@ -1190,17 +1267,38 @@
1190 1267
1191 1268 $sections = self::get_settings_tabs( $values );
1192 1269 $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'advanced_settings' );
1193 1270
1194 - require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
1271 + require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php';
1195 1272 }
1196 1273
1197 1274 /**
1275 + * Print WordPress media templates email actions does not trigger a "Uncaught Error: Template not found: #tmpl-media-selection" error when the media button is clicked.
1276 + *
1277 + * @since 6.10
1278 + *
1279 + * @return void
1280 + */
1281 + private static function maybe_print_media_templates() {
1282 + if ( FrmAppHelper::pro_is_included() ) {
1283 + // This issue does not exist when Pro is active so exit early.
1284 + return;
1285 + }
1286 +
1287 + add_action(
1288 + 'wp_enqueue_editor',
1289 + function () {
1290 + wp_print_media_templates();
1291 + }
1292 + );
1293 + }
1294 +
1295 + /**
1198 1296 * @since 4.0
1199 1297 */
1200 1298 public static function form_publish_button( $atts ) {
1201 1299 $values = $atts['values'];
1202 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' );
1300 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php';
1203 1301 }
1204 1302
1205 1303 /**
1206 1304 * Get a list of all the settings tabs for the form settings page.
@@ -1225,9 +1323,9 @@
1225 1323 'icon' => 'frm_icon_font frm_mail_bulk_icon',
1226 1324 ),
1227 1325 'permissions' => array(
1228 1326 'name' => __( 'Form Permissions', 'formidable' ),
1229 - 'icon' => 'frm_icon_font frm_lock_icon',
1327 + 'icon' => 'frm_icon_font frm_lock_closed_icon',
1230 1328 'html_class' => 'frm_show_upgrade_tab frm_noallow',
1231 1329 'data' => array(
1232 1330 'medium' => 'permissions',
1233 1331 'upgrade' => __( 'Form Permissions', 'formidable' ),
@@ -1234,9 +1332,9 @@
1234 1332 'message' => __( 'Allow editing, protect forms and files, limit entries, and save drafts. Upgrade to get form and entry permissions.', 'formidable' ),
1235 1333 'screenshot' => 'permissions.png',
1236 1334 ),
1237 1335 ),
1238 - 'scheduling' => array(
1336 + 'scheduling' => array(
1239 1337 'name' => __( 'Form Scheduling', 'formidable' ),
1240 1338 'icon' => 'frm_icon_font frm_calendar_icon',
1241 1339 'html_class' => 'frm_show_upgrade_tab frm_noallow',
1242 1340 'data' => array(
@@ -1269,9 +1367,9 @@
1269 1367 'screenshot' => 'chat.png',
1270 1368 )
1271 1369 ),
1272 1370 ),
1273 - 'abandonment' => array(
1371 + 'abandonment' => array(
1274 1372 'name' => __( 'Form Abandonment', 'formidable' ),
1275 1373 'icon' => 'frm_icon_font frm_abandoned_icon',
1276 1374 'html_class' => 'frm_show_upgrade_tab frm_noallow',
1277 1375 'data' => FrmAppHelper::get_upgrade_data_params(
@@ -1298,13 +1396,8 @@
1298 1396 }
1299 1397
1300 1398 $sections = apply_filters( 'frm_add_form_settings_section', $sections, $values );
1301 1399
1302 - if ( FrmAppHelper::pro_is_installed() && ! FrmAppHelper::meets_min_pro_version( '4.0' ) ) {
1303 - // Prevent settings from showing in 2 spots.
1304 - unset( $sections['permissions'], $sections['scheduling'] );
1305 - }
1306 -
1307 1400 foreach ( $sections as $key => $section ) {
1308 1401 $defaults = array(
1309 1402 'html_class' => '',
1310 1403 'name' => ucfirst( $key ),
@@ -1326,9 +1419,9 @@
1326 1419 $section['id'] = $section['anchor'];
1327 1420 }
1328 1421
1329 1422 $sections[ $key ] = $section;
1330 - }
1423 + }//end foreach
1331 1424
1332 1425 return $sections;
1333 1426 }
1334 1427
@@ -1335,8 +1428,9 @@
1335 1428 /**
1336 1429 * @since 4.0
1337 1430 *
1338 1431 * @param array $values
1432 + * @return void
1339 1433 */
1340 1434 public static function advanced_settings( $values ) {
1341 1435 $first_h3 = 'frm_first_h3';
1342 1436
@@ -1344,8 +1438,9 @@
1344 1438 }
1345 1439
1346 1440 /**
1347 1441 * @param array $values
1442 + * @return void
1348 1443 */
1349 1444 public static function render_spam_settings( $values ) {
1350 1445 if ( function_exists( 'akismet_http_post' ) ) {
1351 1446 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php';
@@ -1357,16 +1452,12 @@
1357 1452 /**
1358 1453 * @since 4.0
1359 1454 *
1360 1455 * @param array $values
1456 + * @return void
1361 1457 */
1362 1458 public static function buttons_settings( $values ) {
1363 - $styles = apply_filters( 'frm_get_style_opts', array() );
1364 -
1365 - $frm_settings = FrmAppHelper::get_settings();
1366 - $no_global_style = $frm_settings->load_style === 'none';
1367 -
1368 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-buttons.php' );
1459 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-buttons.php';
1369 1460 }
1370 1461
1371 1462 /**
1372 1463 * @since 4.0
@@ -1371,11 +1462,12 @@
1371 1462 /**
1372 1463 * @since 4.0
1373 1464 *
1374 1465 * @param array $values
1466 + * @return void
1375 1467 */
1376 1468 public static function html_settings( $values ) {
1377 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-html.php' );
1469 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-html.php';
1378 1470 }
1379 1471
1380 1472 /**
1381 1473 * Replace old Submit Button href with new href to avoid errors in Chrome
@@ -1381,9 +1473,10 @@
1381 1473 * Replace old Submit Button href with new href to avoid errors in Chrome
1382 1474 *
1383 1475 * @since 2.03.08
1384 1476 *
1385 - * @param array|boolean $values
1477 + * @param array|bool $values
1478 + * @return void
1386 1479 */
1387 1480 private static function clean_submit_html( &$values ) {
1388 1481 if ( is_array( $values ) && isset( $values['submit_html'] ) ) {
1389 1482 $values['submit_html'] = str_replace( 'javascript:void(0)', '#', $values['submit_html'] );
@@ -1404,8 +1497,13 @@
1404 1497
1405 1498 return $classes;
1406 1499 }
1407 1500
1501 + /**
1502 + * @param int|string $form_id
1503 + * @param string $class
1504 + * @return void
1505 + */
1408 1506 public static function mb_tags_box( $form_id, $class = '' ) {
1409 1507 $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
1410 1508
1411 1509 /**
@@ -1418,9 +1516,9 @@
1418 1516 */
1419 1517 $fields = apply_filters( 'frm_fields_in_tags_box', $fields, compact( 'form_id' ) );
1420 1518 $linked_forms = array();
1421 1519 $col = 'one';
1422 - $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
1520 + $settings_tab = FrmAppHelper::is_admin_page( 'formidable' );
1423 1521
1424 1522 $cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
1425 1523 $entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
1426 1524
@@ -1425,9 +1523,9 @@
1425 1523 $entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
1426 1524
1427 1525 $advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );
1428 1526
1429 - include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
1527 + include FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php';
1430 1528 }
1431 1529
1432 1530 /**
1433 1531 * @since 3.04.01
@@ -1440,9 +1538,9 @@
1440 1538 ),
1441 1539 );
1442 1540
1443 1541 $user_fields = self::user_shortcodes();
1444 - if ( ! empty( $user_fields ) ) {
1542 + if ( $user_fields ) {
1445 1543 $user_helpers = array();
1446 1544 foreach ( $user_fields as $uk => $uf ) {
1447 1545 $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1448 1546 unset( $uk, $uf );
@@ -1448,9 +1546,9 @@
1448 1546 unset( $uk, $uf );
1449 1547 }
1450 1548
1451 1549 $advanced_helpers['user_id'] = array(
1452 - 'codes' => $user_helpers,
1550 + 'codes' => $user_helpers,
1453 1551 );
1454 1552 }
1455 1553
1456 1554 /**
@@ -1591,11 +1689,11 @@
1591 1689 check_ajax_referer( 'frm_ajax', 'nonce' );
1592 1690
1593 1691 echo FrmEntriesController::show_entry_shortcode( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1594 1692 array(
1595 - 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
1693 + 'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1596 1694 'default_email' => true,
1597 - 'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
1695 + 'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1598 1696 )
1599 1697 );
1600 1698 wp_die();
1601 1699 }
@@ -1601,10 +1699,10 @@
1601 1699 }
1602 1700
1603 1701 /**
1604 1702 * @param string $content
1605 - * @param stdClass|string|int $form
1606 - * @param stdClass|string|int|false $entry
1703 + * @param int|stdClass|string $form
1704 + * @param false|int|stdClass|string $entry
1607 1705 * @return string
1608 1706 */
1609 1707 public static function filter_content( $content, $form, $entry = false ) {
1610 1708 $content = self::replace_form_name_shortcodes( $content, $form );
@@ -1628,11 +1726,11 @@
1628 1726 * Replace any [form_name] shortcodes in a string.
1629 1727 *
1630 1728 * @since 5.5
1631 1729 *
1632 - * @param string|array $string
1633 - * @param stdClass|string|int $form
1634 - * @return string|array
1730 + * @param array|string $string
1731 + * @param int|stdClass|string $form
1732 + * @return array|string
1635 1733 */
1636 1734 public static function replace_form_name_shortcodes( $string, $form ) {
1637 1735 if ( ! is_string( $string ) ) {
1638 1736 return $string;
@@ -1650,9 +1748,9 @@
1650 1748 return str_replace( '[form_name]', $form_name, $string );
1651 1749 }
1652 1750
1653 1751 /**
1654 - * @param stdClass|string|int|false $entry
1752 + * @param false|int|stdClass|string $entry
1655 1753 * @return void
1656 1754 */
1657 1755 private static function get_entry_by_param( &$entry ) {
1658 1756 if ( ! $entry || ! is_object( $entry ) ) {
@@ -1667,8 +1765,12 @@
1667 1765 public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
1668 1766 return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
1669 1767 }
1670 1768
1769 + /**
1770 + * @param array $errors
1771 + * @return array
1772 + */
1671 1773 public static function process_bulk_form_actions( $errors ) {
1672 1774 if ( ! $_REQUEST ) {
1673 1775 return $errors;
1674 1776 }
@@ -1712,9 +1814,9 @@
1712 1814 case 'untrash':
1713 1815 $message = self::bulk_untrash( $ids );
1714 1816 }
1715 1817
1716 - if ( isset( $message ) && ! empty( $message ) ) {
1818 + if ( ! empty( $message ) ) {
1717 1819 $errors['message'] = $message;
1718 1820 }
1719 1821
1720 1822 return $errors;
@@ -1734,9 +1836,9 @@
1734 1836 $json_vars = json_decode( $json_vars, true );
1735 1837 if ( empty( $json_vars ) ) {
1736 1838 // json decoding failed so we should return an error message.
1737 1839 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1738 - if ( 'edit' == $action ) {
1840 + if ( 'edit' === $action ) {
1739 1841 $action = 'update';
1740 1842 }
1741 1843
1742 1844 add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
@@ -1752,16 +1854,14 @@
1752 1854 if ( isset( $_REQUEST['delete_all'] ) ) {
1753 1855 // Override the action for this page.
1754 1856 $action = 'delete_all';
1755 1857 }
1756 - }
1858 + }//end if
1757 1859
1758 1860 add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1759 1861 FrmAppHelper::trigger_hook_load( 'form' );
1760 1862
1761 1863 switch ( $action ) {
1762 - case 'new':
1763 - return self::new_form( $vars );
1764 1864 case 'create':
1765 1865 case 'edit':
1766 1866 case 'update':
1767 1867 case 'trash':
@@ -1766,9 +1866,8 @@
1766 1866 case 'update':
1767 1867 case 'trash':
1768 1868 case 'untrash':
1769 1869 case 'destroy':
1770 - case 'delete_all':
1771 1870 case 'settings':
1772 1871 case 'update_settings':
1773 1872 return self::$action( $vars );
1774 1873 case 'lite-reports':
@@ -1798,14 +1897,47 @@
1798 1897 self::display_forms_list( array(), '', array( __( 'There was a problem duplicating the form', 'formidable' ) ) );
1799 1898 return;
1800 1899 }
1801 1900
1901 + if ( 'forms_permanently_deleted' === $message ) {
1902 + $count = FrmAppHelper::get_param( 'forms_deleted', 0, 'get', 'absint' );
1903 + /* translators: %1$s: Number of forms */
1904 + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
1905 + self::display_forms_list( array(), $message, '' );
1906 + return;
1907 + }
1908 +
1802 1909 self::display_forms_list();
1803 1910
1804 1911 return;
1805 - }
1912 + }//end switch
1806 1913 }
1807 1914
1915 + /**
1916 + * Rename a form.
1917 + *
1918 + * Handles the AJAX request for renaming a form.
1919 + *
1920 + * @since 6.7
1921 + *
1922 + * @return void
1923 + */
1924 + public static function rename_form() {
1925 + // Check permission and nonce
1926 + FrmAppHelper::permission_check( 'frm_edit_forms' );
1927 + check_ajax_referer( 'frm_ajax', 'nonce' );
1928 +
1929 + // Get posted data
1930 + $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
1931 + $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
1932 +
1933 + // Update the form name and form key.
1934 + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
1935 + FrmForm::update( $form_id, compact( 'name', 'form_key' ) );
1936 +
1937 + wp_send_json_success( compact( 'form_key' ) );
1938 + }
1939 +
1808 1940 public static function json_error( $errors ) {
1809 1941 $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1810 1942
1811 1943 return $errors;
@@ -1814,11 +1946,12 @@
1814 1946 /**
1815 1947 * Education for premium features.
1816 1948 *
1817 1949 * @since 4.05
1950 + * @return void
1818 1951 */
1819 1952 public static function add_form_style_tab_options() {
1820 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php' );
1953 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php';
1821 1954 }
1822 1955
1823 1956 /**
1824 1957 * Add education about views.
@@ -1844,9 +1977,11 @@
1844 1977
1845 1978 include FrmAppHelper::plugin_path() . '/classes/views/shared/reports-info.php';
1846 1979 }
1847 1980
1848 - /* FRONT-END FORMS */
1981 + /**
1982 + * FRONT-END FORMS.
1983 + */
1849 1984 public static function admin_bar_css() {
1850 1985 if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1851 1986 return;
1852 1987 }
@@ -1935,10 +2070,10 @@
1935 2070 * @return string
1936 2071 */
1937 2072 public static function get_form_shortcode( $atts ) {
1938 2073 global $frm_vars;
1939 - if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1940 - $sc = '[formidable';
2074 + if ( ! empty( $frm_vars['skip_shortcode'] ) ) {
2075 + $sc = '[formidable';
1941 2076 $sc .= FrmAppHelper::array_to_html_params( $atts );
1942 2077 return $sc . ']';
1943 2078 }
1944 2079
@@ -1963,11 +2098,11 @@
1963 2098
1964 2099 /**
1965 2100 * @since 5.2.01
1966 2101 *
1967 - * @param string|int|false $id
1968 - * @param string|false $key
1969 - * @return stdClass|false
2102 + * @param false|int|string $id
2103 + * @param false|string $key
2104 + * @return false|stdClass
1970 2105 */
1971 2106 private static function maybe_get_form_by_id_or_key( $id, $key ) {
1972 2107 if ( ! $id ) {
1973 2108 $id = $key;
@@ -1975,12 +2110,12 @@
1975 2110 return self::maybe_get_form_to_show( $id );
1976 2111 }
1977 2112
1978 2113 /**
1979 - * @param string|int|false $id
1980 - * @param string|false $key
1981 - * @param string|int|bool $title may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
1982 - * @param string|int|bool $description may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2114 + * @param false|int|string $id
2115 + * @param false|string $key
2116 + * @param bool|int|string $title may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2117 + * @param bool|int|string $description may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
1983 2118 * @param array $atts
1984 2119 * @return string
1985 2120 */
1986 2121 public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
@@ -2028,15 +2163,16 @@
2028 2163 return $form;
2029 2164 }
2030 2165
2031 2166 /**
2032 - * @param string|int|false $id
2033 - * @return stdClass|false
2167 + * @param false|int|string $id
2168 + * @return false|stdClass
2034 2169 */
2035 2170 private static function maybe_get_form_to_show( $id ) {
2036 2171 $form = false;
2037 2172
2038 - if ( ! empty( $id ) ) { // form id or key is set
2173 + if ( ! empty( $id ) ) {
2174 + // Form id or key is set.
2039 2175 $form = FrmForm::getOne( $id );
2040 2176 if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2041 2177 $form = false;
2042 2178 }
@@ -2094,11 +2230,11 @@
2094 2230
2095 2231 do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description );
2096 2232
2097 2233 if ( apply_filters( 'frm_continue_to_create', true, $form->id ) ) {
2098 - $entry_id = self::just_created_entry( $form->id );
2099 - $pass_args['entry_id'] = $entry_id;
2100 - $pass_args['reset'] = true;
2234 + $entry_id = self::just_created_entry( $form->id );
2235 + $pass_args['entry_id'] = $entry_id;
2236 + $pass_args['reset'] = true;
2101 2237
2102 2238 self::run_on_submit_actions( $pass_args );
2103 2239
2104 2240 do_action(
@@ -2108,9 +2244,9 @@
2108 2244 'form' => $form,
2109 2245 )
2110 2246 );
2111 2247 }
2112 - }
2248 + }//end if
2113 2249 }
2114 2250
2115 2251 /**
2116 2252 * If the form was processed earlier (init), get the generated errors
@@ -2142,9 +2278,9 @@
2142 2278 */
2143 2279 public static function just_created_entry( $form_id ) {
2144 2280 global $frm_vars;
2145 2281
2146 - return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
2282 + return isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
2147 2283 }
2148 2284
2149 2285 /**
2150 2286 * Gets confirmation method.
@@ -2157,14 +2293,14 @@
2157 2293 *
2158 2294 * @type object $form Form object.
2159 2295 * @type int $entry_id Entry ID.
2160 2296 * }
2161 - * @return string|array
2297 + * @return array|string
2162 2298 */
2163 2299 private static function get_confirmation_method( $atts ) {
2164 2300 $action = FrmOnSubmitHelper::current_event( $atts );
2165 2301 $opt = 'update' === $action ? 'edit_action' : 'success_action';
2166 - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
2302 + $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2167 2303
2168 2304 if ( ! empty( $atts['entry_id'] ) ) {
2169 2305 $met_actions = self::get_met_on_submit_actions( $atts, $action );
2170 2306 if ( $met_actions ) {
@@ -2173,9 +2309,9 @@
2173 2309 }
2174 2310
2175 2311 $method = apply_filters( 'frm_success_filter', $method, $atts['form'], $action );
2176 2312
2177 - if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) {
2313 + if ( $method !== 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) {
2178 2314 $method = 'message';
2179 2315 }
2180 2316
2181 2317 return $method;
@@ -2260,9 +2396,9 @@
2260 2396 unset( $extra_args['form'] );
2261 2397
2262 2398 do_action( 'frm_success_action', $args['conf_method'], $args['form'], $args['form']->options, $args['entry_id'], $extra_args );
2263 2399
2264 - $opt = ( ! isset( $args['action'] ) || $args['action'] === 'create' ) ? 'success' : 'edit';
2400 + $opt = ! isset( $args['action'] ) || $args['action'] === 'create' ? 'success' : 'edit';
2265 2401
2266 2402 $args['success_opt'] = $opt;
2267 2403 $args['ajax'] = ! empty( $frm_vars['ajax'] );
2268 2404
@@ -2293,11 +2429,11 @@
2293 2429 if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2294 2430 return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2295 2431 }
2296 2432
2297 - $entry = FrmEntry::getOne( $args['entry_id'], true );
2298 - $actions = FrmOnSubmitHelper::get_actions( $args['form']->id );
2299 - $met_actions = array();
2433 + $entry = FrmEntry::getOne( $args['entry_id'], true );
2434 + $actions = FrmOnSubmitHelper::get_actions( $args['form']->id );
2435 + $met_actions = array();
2300 2436 $has_redirect = false;
2301 2437
2302 2438 foreach ( $actions as $action ) {
2303 2439 if ( ! in_array( $event, $action->post_content['event'], true ) ) {
@@ -2310,9 +2446,10 @@
2310 2446
2311 2447 $action_type = FrmOnSubmitHelper::get_action_type( $action );
2312 2448
2313 2449 if ( 'redirect' === $action_type ) {
2314 - if ( $has_redirect ) { // Do not process because we run the first redirect action only.
2450 + if ( $has_redirect ) {
2451 + // Do not process because we run the first redirect action only.
2315 2452 continue;
2316 2453 }
2317 2454 }
2318 2455
@@ -2325,9 +2462,9 @@
2325 2462 }
2326 2463
2327 2464 $met_actions[] = $action;
2328 2465 unset( $action );
2329 - }
2466 + }//end foreach
2330 2467
2331 2468 $args['event'] = $event;
2332 2469
2333 2470 /**
@@ -2516,9 +2653,9 @@
2516 2653 add_filter( 'the_content', 'FrmFormsController::preview_content', 9999 );
2517 2654 }
2518 2655
2519 2656 $post = $old_post;
2520 - }
2657 + }//end if
2521 2658 }
2522 2659
2523 2660 /**
2524 2661 * @since 3.0
@@ -2539,14 +2676,16 @@
2539 2676 $success_url = apply_filters( 'frm_redirect_url', $success_url, $args['form'], $args );
2540 2677
2541 2678 $doing_ajax = FrmAppHelper::doing_ajax();
2542 2679
2543 - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs.
2680 + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) {
2681 + // Is AJAX submit and there is just one Redirect action runs.
2544 2682 echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) );
2545 2683 wp_die();
2546 2684 }
2547 2685
2548 - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2686 + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) {
2687 + // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2549 2688 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2550 2689 self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2551 2690 self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2552 2691 return;
@@ -2552,9 +2691,10 @@
2552 2691 return;
2553 2692 }
2554 2693
2555 2694 wp_redirect( esc_url_raw( $success_url ) );
2556 - die(); // do not use wp_die or redirect fails
2695 + // Do not use wp_die or redirect fails.
2696 + die();
2557 2697 }
2558 2698
2559 2699 // Redirect with a delay.
2560 2700 self::redirect_after_submit_using_js( $args + compact( 'success_url', 'doing_ajax' ) );
@@ -2645,9 +2785,10 @@
2645 2785 add_filter( 'frm_use_wpautop', '__return_true' );
2646 2786
2647 2787 echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2648 2788 echo '<script>';
2649 - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load.
2789 + if ( empty( $args['doing_ajax'] ) ) {
2790 + // Not AJAX submit, delay JS until window.load.
2650 2791 echo 'window.onload=function(){';
2651 2792 }
2652 2793 echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2653 2794 if ( empty( $args['doing_ajax'] ) ) {
@@ -2660,9 +2801,9 @@
2660 2801 * @since 3.0
2661 2802 *
2662 2803 * @param string $success_url
2663 2804 * @param string $success_msg
2664 - * @param array $args
2805 + * @param array $args
2665 2806 */
2666 2807 private static function get_redirect_message( $success_url, $success_msg, $args ) {
2667 2808 $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg" role="status">' . $success_msg . '<br/>' .
2668 2809 self::get_redirect_fallback_message( $success_url, $args ) .
@@ -2761,11 +2902,10 @@
2761 2902 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
2762 2903 }
2763 2904
2764 2905 /**
2906 + * @since 4.05.02
2765 2907 * @return string - 'before', 'after', or 'submit'
2766 - *
2767 - * @since 4.05.02
2768 2908 */
2769 2909 private static function message_placement( $form, $message ) {
2770 2910 $place = 'before';
2771 2911
@@ -2777,11 +2917,10 @@
2777 2917 }
2778 2918 }
2779 2919
2780 2920 /**
2921 + * @since 4.05.02
2781 2922 * @return string - 'before' or 'after'
2782 - *
2783 - * @since 4.05.02
2784 2923 */
2785 2924 return apply_filters( 'frm_message_placement', $place, compact( 'form', 'message' ) );
2786 2925 }
2787 2926
@@ -2826,9 +2965,9 @@
2826 2965 $errors = array();
2827 2966 $form = $atts['form'];
2828 2967 $message = $atts['message'];
2829 2968
2830 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
2969 + include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php';
2831 2970 }
2832 2971
2833 2972 /**
2834 2973 * Prepare the success message before it's shown
@@ -2948,9 +3087,9 @@
2948 3087 global $frm_vars;
2949 3088
2950 3089 FrmStylesController::enqueue_css();
2951 3090
2952 - if ( ! FrmAppHelper::is_admin() && $location != 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
3091 + if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
2953 3092 // load formidable js
2954 3093 wp_enqueue_script( 'formidable' );
2955 3094 }
2956 3095 }
@@ -2966,12 +3105,12 @@
2966 3105 }
2967 3106
2968 3107 /**
2969 3108 * @since 2.0.8
2970 - * @return boolean
3109 + * @return bool
2971 3110 */
2972 3111 private static function is_minification_on( $atts ) {
2973 - return isset( $atts['minimize'] ) && ! empty( $atts['minimize'] );
3112 + return ! empty( $atts['minimize'] );
2974 3113 }
2975 3114
2976 3115 /**
2977 3116 * @since 5.0.16
@@ -2999,9 +3138,9 @@
2999 3138 * Create a page with an embedded formidable Gutenberg block.
3000 3139 *
3001 3140 * @since 5.2
3002 3141 *
3003 - * @return never
3142 + * @return void
3004 3143 */
3005 3144 public static function create_page_with_shortcode() {
3006 3145 if ( ! current_user_can( 'publish_posts' ) ) {
3007 3146 die( 0 );
@@ -3046,10 +3185,9 @@
3046 3185
3047 3186 /**
3048 3187 * @since 5.3
3049 3188 *
3050 - * @param string $content
3051 - * @param int $form_id
3189 + * @param int $form_id
3052 3190 * @return string
3053 3191 */
3054 3192 private static function get_page_shortcode_content_for_form( $form_id ) {
3055 3193 $shortcode = '[formidable id="' . $form_id . '"]';
@@ -3060,9 +3198,9 @@
3060 3198
3061 3199 /**
3062 3200 * Get page dropdown for AJAX request for embedding form in an existing page.
3063 3201 *
3064 - * @return never
3202 + * @return void
3065 3203 */
3066 3204 public static function get_page_dropdown() {
3067 3205 if ( ! current_user_can( 'publish_posts' ) ) {
3068 3206 die( 0 );
@@ -3070,9 +3208,9 @@
3070 3208
3071 3209 check_ajax_referer( 'frm_ajax', 'nonce' );
3072 3210
3073 3211 $html = FrmAppHelper::clip(
3074 - function() {
3212 + function () {
3075 3213 FrmAppHelper::maybe_autocomplete_pages_options(
3076 3214 array(
3077 3215 'field_name' => 'frm_page_dropdown',
3078 3216 'page_id' => '',
@@ -3092,15 +3230,8 @@
3092 3230
3093 3231 /**
3094 3232 * @deprecated 4.0
3095 3233 */
3096 - public static function new_form( $values = array() ) {
3097 - FrmDeprecated::new_form( $values );
3098 - }
3099 -
3100 - /**
3101 - * @deprecated 4.0
3102 - */
3103 3234 public static function create( $values = array() ) {
3104 3235 _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' );
3105 3236 self::update( $values );
3106 3237 }
@@ -3105,35 +3236,13 @@
3105 3236 self::update( $values );
3106 3237 }
3107 3238
3108 3239 /**
3109 - * @deprecated 3.0
3110 - * @codeCoverageIgnore
3240 + * @deprecated 6.7
3241 + *
3242 + * @return bool
3111 3243 */
3112 - public static function bulk_create_template( $ids ) {
3113 - return FrmDeprecated::bulk_create_template( $ids );
3114 - }
3115 -
3116 - /**
3117 - * @deprecated 3.0
3118 - * @codeCoverageIgnore
3119 - */
3120 - public static function edit_key() {
3121 - FrmDeprecated::edit_key();
3122 - }
3123 -
3124 - /**
3125 - * @deprecated 3.0
3126 - * @codeCoverageIgnore
3127 - */
3128 - public static function edit_description() {
3129 - FrmDeprecated::edit_description();
3130 - }
3131 -
3132 - /**
3133 - * @deprecated 4.08
3134 - * @since 3.06
3135 - */
3136 - public static function add_new() {
3137 - _deprecated_function( __FUNCTION__, '4.08' );
3244 + public static function expired() {
3245 + _deprecated_function( __METHOD__, '6.7' );
3246 + return FrmAddonsController::is_license_expired();
3138 3247 }
3139 3248 }