/home/altere25/public_html/wp-content/plugins/formidable/classes/controllers
Edit: /home/altere25/public_html/wp-content/plugins/formidable/classes/controllers/FrmFormsController.php (96486B)
';
echo '
';
esc_html_e( 'Conditional Logic', 'formidable' );
FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) );
echo '';
}
/**
* By default, Divi processes form shortcodes on the edit post page.
* Now that won't do.
*
* @since 3.01
*/
public static function prevent_divi_conflict( $shortcodes ) {
$shortcodes[] = 'formidable';
return $shortcodes;
}
/**
* @return void
*/
public static function list_form() {
FrmAppHelper::permission_check( 'frm_view_forms' );
$message = '';
$params = FrmForm::list_page_params();
$errors = self::process_bulk_form_actions( array() );
if ( isset( $errors['message'] ) ) {
$message = $errors['message'];
unset( $errors['message'] );
}
$errors = apply_filters( 'frm_admin_list_form_action', $errors );
self::display_forms_list( $params, $message, $errors );
}
/**
* Create the default email action
*
* @since 2.02.11
*
* @param int|object $form
*/
private static function create_default_email_action( $form ) {
FrmForm::maybe_get_form( $form );
$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
if ( $create_email ) {
/**
* @var FrmFormAction
*/
$action_control = FrmFormActionsController::get_form_actions( 'email' );
$action_control->create( $form->id );
}
}
/**
* Create the default On submit action
*
* @since 6.0.0
*
* @param int|object $form Form object or ID.
*/
private static function create_default_on_submit_action( $form ) {
FrmForm::maybe_get_form( $form );
/**
* Enable or disable the default On Submit action.
*
* @since 6.0.0
*
* @param bool $create Set to `false` if you want to disable.
* @param object $form Form object.
*/
$create = apply_filters( 'frm_create_default_on_submit_action', true, $form );
if ( $create ) {
/**
* @var FrmFormAction
*/
$action_control = FrmFormActionsController::get_form_actions( FrmOnSubmitAction::$slug );
$action_control->create( $form->id );
}
}
/**
* Creates submit button field.
*
* @since 6.9
*
* @param int|object $form Form ID or object.
*/
private static function create_submit_button_field( $form ) {
FrmForm::maybe_get_form( $form );
if ( FrmSubmitHelper::get_submit_field( $form->id ) ) {
// Do not create submit button field if it exists.
return;
}
FrmField::create(
array(
'type' => FrmSubmitHelper::FIELD_TYPE,
'name' => __( 'Submit', 'formidable' ),
'field_order' => 9999,
'form_id' => $form->id,
'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ),
'description' => '',
'default_value' => '',
'options' => array(),
)
);
}
/**
* @return void
*/
public static function edit( $values = false ) {
FrmAppHelper::permission_check( 'frm_edit_forms' );
$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
self::get_edit_vars( $id );
}
/**
* @param mixed $id
* @param string $message
* @return void
*/
public static function settings( $id = false, $message = '' ) {
FrmAppHelper::permission_check( 'frm_edit_forms' );
if ( ! $id || ! is_numeric( $id ) ) {
$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
}
FrmOnSubmitHelper::maybe_migrate_submit_settings_to_action( $id );
self::get_settings_vars( $id, array(), $message );
}
public static function update_settings() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
$frm_settings = FrmAppHelper::get_settings();
$error_args = array(
'title' => __( 'Verification failed', 'formidable' ),
'body' => $frm_settings->admin_permission,
'cancel_text' => __( 'Cancel', 'formidable' ),
);
FrmAppController::show_error_modal( $error_args );
return;
}
$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
$errors = FrmForm::validate( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
$warnings = FrmFormsHelper::check_for_warnings( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( count( $errors ) > 0 ) {
self::get_settings_vars( $id, $errors, compact( 'warnings' ) );
return;
}
do_action( 'frm_before_update_form_settings', $id );
$antispam_was_on = self::antispam_was_on( $id );
FrmForm::update( $id, $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
$antispam_is_on = ! empty( $_POST['options']['antispam'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( $antispam_is_on !== $antispam_was_on ) {
FrmAntiSpam::clear_caches();
}
$message = __( 'Settings Successfully Updated', 'formidable' );
self::get_settings_vars( $id, array(), compact( 'message', 'warnings' ) );
}
/**
* @param int $form_id
* @return bool
*/
private static function antispam_was_on( $form_id ) {
$form = FrmForm::getOne( $form_id );
return ! empty( $form->options['antispam'] );
}
/**
* @return void
*/
public static function update( $values = array() ) {
if ( empty( $values ) ) {
$values = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing
}
// Set radio button and checkbox meta equal to "other" value.
if ( FrmAppHelper::pro_is_installed() ) {
$values = FrmProEntry::mod_other_vals( $values, 'back' );
}
$errors = FrmForm::validate( $values );
$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
if ( $permission_error !== false ) {
$errors['form'] = $permission_error;
}
$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
if ( count( $errors ) > 0 ) {
self::get_edit_vars( $id, $errors );
return;
}
self::maybe_remove_draft_option_from_fields( $id );
FrmForm::update( $id, $values );
$message = __( 'Form was successfully updated.', 'formidable' );
if ( self::is_too_long( $values ) ) {
$message .= '
' . sprintf(
/* translators: %1$s: Start link HTML, %2$s: end link HTML */
__( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ),
'
',
''
);
}
if ( defined( 'DOING_AJAX' ) ) {
wp_die( FrmAppHelper::kses( $message, array( 'a' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
self::get_edit_vars( $id, array(), $message );
}
/**
* Remove the draft flag from any new fields from this current session.
*
* @since 6.8
*
* @param int $form_id
* @return void
*/
private static function maybe_remove_draft_option_from_fields( $form_id ) {
$draft_field_ids_csv = FrmAppHelper::get_post_param( 'draft_fields', '', 'sanitize_text_field' );
if ( ! $draft_field_ids_csv ) {
// If the draft_fields input is empty there are no new fields in the session.
return;
}
$draft_field_ids = array_filter( explode( ',', $draft_field_ids_csv ), 'is_numeric' );
if ( ! $draft_field_ids ) {
// Exit early if the draft fields input is invalid. It should be a CSV of integer values.
return;
}
$draft_field_rows = FrmFieldsHelper::get_draft_field_results( $form_id, $draft_field_ids );
foreach ( $draft_field_rows as $row ) {
$row->field_options['draft'] = 0;
FrmField::update( $row->id, array( 'field_options' => $row->field_options ) );
}
}
/**
* Check if the value at the end of the form was included.
* If it's missing, it means other values at the end of the form
* were likely not saved either.
*
* @since 3.06.01
*
* @return bool
*/
private static function is_too_long( $values ) {
return empty( $values['frm_end'] );
}
public static function duplicate() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
$nonce = FrmAppHelper::simple_get( '_wpnonce' );
if ( ! wp_verify_nonce( $nonce ) ) {
$frm_settings = FrmAppHelper::get_settings();
wp_die( esc_html( $frm_settings->admin_permission ) );
}
$params = FrmForm::list_page_params();
$form = FrmForm::duplicate( $params['id'], $params['template'], true );
$url = admin_url( 'admin.php?page=formidable' );
$message = 'form_duplicate_error';
if ( $form ) {
$new_template = FrmAppHelper::simple_get( 'new_template' ) ? '&new_template=true' : '';
$url = admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $form ) . $new_template );
$message = 'form_duplicated';
}
$url .= '&message=' . $message;
wp_safe_redirect( $url );
exit();
}
/**
* @return string|null
*/
public static function page_preview() {
$params = FrmForm::list_page_params();
if ( ! $params['form'] ) {
return null;
}
$form = FrmForm::getOne( $params['form'] );
if ( ! $form ) {
return null;
}
return self::show_form( $form->id, '', 'auto', 'auto' );
}
/**
* @since 3.0
*
* @return void
*/
public static function show_page_preview() {
echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* @return void
*/
public static function preview() {
do_action( 'frm_wp' );
FrmAppHelper::set_current_screen_and_hook_suffix();
global $frm_vars;
$frm_vars['preview'] = true;
$include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' );
if ( $include_theme ) {
self::set_preview_query();
self::load_theme_preview();
} else {
self::load_direct_preview();
}
wp_die();
}
/**
* Set the page global to any available page (except for the Blog Page).
*
* @return void
*/
private static function set_preview_query() {
$page_query = array(
'numberposts' => 1,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'page',
);
$page_for_posts = get_option( 'page_for_posts' );
if ( is_numeric( $page_for_posts ) ) {
// Avoid querying for the "Posts Page" or "Blog Page" so we don't display 10 forms.
$page_query['post__not_in'] = array( $page_for_posts );
}
$random_page = get_posts( $page_query );
if ( ! $random_page ) {
return;
}
$random_page = reset( $random_page );
if ( ! is_a( $random_page, 'WP_Post' ) ) {
// The return type can also be int.
return;
}
query_posts(
array(
'post_type' => 'page',
'page_id' => $random_page->ID,
)
);
// Fixes Pro issue #3004. Prevent an undefined $post object.
// Otherwise WordPress themes will trigger a warning "Attempt to read property "comment_count" on null".
self::set_post_global( $random_page );
}
/**
* Set the WP $post global object. Used for in-theme preview when defining a page.
*
* @since 5.5.2
*
* @param WP_Post $page The page object.
* @return void
*/
private static function set_post_global( $page ) {
global $post;
$post = $page; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
}
/**
* @since 3.0
*
* @return void
*/
private static function load_theme_preview() {
add_filter( 'wp_title', 'FrmFormsController::preview_title', 9999 );
add_filter( 'the_title', 'FrmFormsController::preview_page_title', 9999 );
add_filter( 'the_content', 'FrmFormsController::preview_content', 9999 );
add_action( 'loop_no_results', 'FrmFormsController::show_page_preview' );
add_filter( 'is_active_sidebar', '__return_false' );
FrmStylesController::enqueue_css( 'enqueue', true );
if ( false === get_template_part( 'page' ) ) {
if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) {
add_filter( 'body_class', 'FrmFormsController::preview_block_theme_body_classnames' );
}
self::fallback_when_page_template_part_is_not_supported_by_theme();
}
}
/**
* Add padding to the body for block themes.
*
* @since 6.5.2
*
* @param array $classes The body classes list.
* @return array
*/
public static function preview_block_theme_body_classnames( $classes ) {
$classes[] = 'has-global-padding';
return $classes;
}
/**
* Not every theme supports get_template_part( 'page' ).
* When this is not supported, false is returned, and we can handle a fallback.
*
* @return void
*/
private static function fallback_when_page_template_part_is_not_supported_by_theme() {
if ( have_posts() ) {
the_post();
self::get_template( 'header' );
// add some generic class names to the container to add some natural padding to the content.
// .entry-content catches the WordPress TwentyTwenty theme.
// .container catches Customizr content.
echo '
';
the_content();
echo '
';
self::get_template( 'footer' );
}
}
/**
* Calls core function to get a template part if it doesn't cause deprecation warnings. Otherwise skips the deprecation function call
* and renders required html fragments calling required functions.
*
* @since 6.7.1
* @param string $template
* @return void
*/
private static function get_template( $template ) {
if ( self::should_try_getting_template( $template ) ) {
call_user_func( 'get_' . $template );
return;
}
if ( 'header' === $template ) {
include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/header.php';
return;
}
if ( 'footer' === $template ) {
include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/footer.php';
}
}
/**
* Returns true if calling a template function doesn't trigger deprecation warnings.
*
* @since 6.7.1
* @param string $template
* @return bool
*/
private static function should_try_getting_template( $template ) {
$stylesheet_path = get_stylesheet_directory();
$template_path = get_template_directory();
$is_child_theme = $stylesheet_path !== $template_path;
$template_name = $template . '.php';
return file_exists( $stylesheet_path . '/' . $template_name ) || $is_child_theme && file_exists( $template_path . '/' . $template_name );
}
/**
* Set the page title for the theme preview page
*
* @since 3.0
*/
public static function preview_page_title( $title ) {
if ( in_the_loop() ) {
$title = self::preview_title( $title );
}
return $title;
}
/**
* Set the page title for the theme preview page.
*
* @since 3.0
*
* @param string $title
* @return string
*/
public static function preview_title( $title ) {
return __( 'Form Preview', 'formidable' );
}
/**
* Set the page content for the theme preview page.
*
* @since 3.0
*
* @param string $content
* @return string
*/
public static function preview_content( $content ) {
if ( in_the_loop() ) {
self::show_page_preview();
// Clear the content for the page we're using.
$content = '';
}
return $content;
}
/**
* @since 3.0
*/
private static function load_direct_preview() {
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
// print_emoji_styles is deprecated.
remove_action( 'wp_print_styles', 'print_emoji_styles' );
$key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
if ( $key == '' ) {
$key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
}
$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
if ( empty( $form ) ) {
$form = FrmForm::getAll( array(), '', 1 );
}
self::fix_deprecated_null_param_warning();
require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
}
/**
* Some themes have a null $src value.
* This function adds a filter to ensure that $src is not null.
* WP will call str_starts_with with the null value triggering a deprecated message otherwise.
*
* @since 6.10
*
* @return void
*/
private static function fix_deprecated_null_param_warning() {
add_filter(
'script_loader_src',
/**
* @param string|null $src
* @return string
*/
function ( $src ) {
if ( is_null( $src ) ) {
$src = '';
}
return $src;
}
);
}
public static function untrash() {
self::change_form_status( 'untrash' );
}
/**
* @param array $ids
* @return string
*/
public static function bulk_untrash( $ids ) {
FrmAppHelper::permission_check( 'frm_edit_forms' );
$count = FrmForm::set_status( $ids, 'published' );
if ( ! $count ) {
// Don't show "0 forms restored" on refresh.
return '';
}
/* translators: %1$s: Number of forms */
$message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
return $message;
}
/**
* @since 3.06
*/
public static function ajax_trash() {
FrmAppHelper::permission_check( 'frm_delete_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );
$form_id = FrmAppHelper::get_param( 'id', '', 'post', 'absint' );
FrmForm::set_status( $form_id, 'trash' );
wp_die();
}
public static function trash() {
self::change_form_status( 'trash' );
}
/**
* @param string $status
*
* @return void
*/
public static function change_form_status( $status ) {
$available_status = array(
'untrash' => array(
'permission' => 'frm_edit_forms',
'new_status' => 'published',
),
'trash' => array(
'permission' => 'frm_delete_forms',
'new_status' => 'trash',
),
);
if ( ! isset( $available_status[ $status ] ) ) {
return;
}
FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
$params = FrmForm::list_page_params();
// Check nonce url.
check_admin_referer( $status . '_form_' . $params['id'] );
$count = 0;
if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
++$count;
}
$form_type = FrmAppHelper::get_simple_request(
array(
'param' => 'form_type',
'type' => 'request',
)
);
/* translators: %1$s: Number of forms */
$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
$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, '
', '' );
$message = $available_status[ $status ]['message'];
self::display_forms_list( $params, $message );
}
/**
* @param array $ids
* @return string
*/
public static function bulk_trash( $ids ) {
FrmAppHelper::permission_check( 'frm_delete_forms' );
$count = 0;
foreach ( $ids as $id ) {
if ( FrmForm::trash( $id ) ) {
++$count;
}
}
$current_page = FrmAppHelper::get_simple_request(
array(
'param' => 'form_type',
'type' => 'request',
)
);
$message = sprintf(
/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
_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,
'
',
''
);
return $message;
}
public static function destroy() {
FrmAppHelper::permission_check( 'frm_delete_forms' );
$params = FrmForm::list_page_params();
// Check nonce url.
check_admin_referer( 'destroy_form_' . $params['id'] );
$count = 0;
if ( FrmForm::destroy( $params['id'] ) ) {
++$count;
}
/* translators: %1$s: Number of forms */
$message = sprintf( _n( '%1$s Form Permanently Deleted', '%1$s Forms Permanently Deleted', $count, 'formidable' ), $count );
self::display_forms_list( $params, $message );
}
/**
* @param array $ids
* @return string
*/
public static function bulk_destroy( $ids ) {
FrmAppHelper::permission_check( 'frm_delete_forms' );
$count = 0;
foreach ( $ids as $id ) {
$d = FrmForm::destroy( $id );
if ( $d ) {
++$count;
}
}
if ( $count ) {
/* translators: %1$s: Number of forms */
return sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
}
return '';
}
/**
* @since 6.7.1 Function went from private to public.
*/
public static function delete_all() {
// Check nonce url.
$permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
if ( $permission_error !== false ) {
self::display_forms_list( array(), '', array( $permission_error ) );
return;
}
$count = FrmForm::scheduled_delete( time() );
$url = remove_query_arg( array( 'delete_all' ) );
$url .= '&message=forms_permanently_deleted&forms_deleted=' . $count;
wp_safe_redirect( $url );
die();
}
/**
* Create a new form from the modal.
*
* @since 4.0
*/
public static function build_new_form() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );
$new_values = self::get_modal_values();
$new_values['form_key'] = $new_values['name'];
$new_values['options'] = array(
'antispam' => 1,
'on_submit_migrated' => 1,
);
/**
* Allows changing form values before creating from the modal.
*
* @since 5.4
*
* @param array $values Form values.
*/
$new_values = apply_filters( 'frm_new_form_values', $new_values );
$form_id = FrmForm::create( $new_values );
/**
* @since 5.3
*
* @param int $form_id
*/
do_action( 'frm_build_new_form', $form_id );
self::create_submit_button_field( $form_id );
self::create_default_on_submit_action( $form_id );
self::create_default_email_action( $form_id );
$response = array(
'redirect' => FrmForm::get_edit_link( $form_id ) . '&new_template=true',
);
echo wp_json_encode( $response );
wp_die();
}
/**
* Before creating a new form, get the name and description from the modal.
*
* @since 4.0
*
* @return array
*/
public static function get_modal_values() {
$name = FrmAppHelper::get_param( 'name', '', 'post', 'sanitize_text_field' );
$desc = FrmAppHelper::get_param( 'desc', '', 'post', 'sanitize_textarea_field' );
return array(
'name' => $name,
'description' => $desc,
);
}
/**
* Inserts Formidable button
* Hook exists since 2.5.0
*
* @since 2.0.15
*
* @return void
*/
public static function insert_form_button() {
if ( current_user_can( 'frm_view_forms' ) ) {
// Store the result in memory and re-use it when this function is called multiple times.
// This helps speed up the form builder when there are a lot of HTML fields, where this
// button is inserted once per HTML field.
// In a form with 66 HTML fields, this saves 0.5 seconds on page load time, tested locally.
if ( ! isset( self::$formidable_tinymce_button ) ) {
FrmAppHelper::load_admin_wide_js();
$menu_name = FrmAppHelper::get_menu_name();
$icon = apply_filters( 'frm_media_icon', FrmAppHelper::svg_logo() );
self::$formidable_tinymce_button = '' . FrmAppHelper::kses( $icon, 'all' ) . ' ' . esc_html( $menu_name ) . '';
}
echo self::$formidable_tinymce_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
/**
* @return void
*/
public static function insert_form_popup() {
if ( ! self::should_insert_form_popup() ) {
return;
}
FrmAppHelper::load_admin_wide_js();
$shortcodes = array(
'formidable' => array(
'name' => __( 'Form', 'formidable' ),
'label' => __( 'Insert a Form', 'formidable' ),
),
);
$shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php';
if ( FrmAppHelper::is_form_builder_page() && ! class_exists( '_WP_Editors', false ) ) {
// initialize a wysiwyg so we have usable settings defined in tinyMCEPreInit.mceInit
require ABSPATH . WPINC . '/class-wp-editor.php';
?>
';
echo '';
$form_id = '';
$opts = array();
switch ( $shortcode ) {
case 'formidable':
$opts = array(
'form_id' => 'id',
'title' => array(
'val' => 1,
'label' => __( 'Display form title', 'formidable' ),
),
'description' => array(
'val' => 1,
'label' => __( 'Display form description', 'formidable' ),
),
'minimize' => array(
'val' => 1,
'label' => __( 'Minimize form HTML', 'formidable' ),
),
);
}
$opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
// allow other shortcodes to use the required form id option
$form_id = $opts['form_id'];
unset( $opts['form_id'] );
}
include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php';
echo ' ';
wp_die();
}
/**
* Display list of forms in a table.
*
* @param array $params
* @param string $message
* @param array $errors
* @return void
*/
public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
FrmAppHelper::permission_check( 'frm_view_forms' );
global $wpdb, $frm_vars;
if ( ! $params ) {
$params = FrmForm::list_page_params();
}
/**
* @since 5.3.1
*
* @param string $table_class Class name for List Helper.
*/
$table_class = apply_filters( 'frm_forms_list_class', 'FrmFormsListHelper' );
$wp_list_table = new $table_class( compact( 'params' ) );
$pagenum = $wp_list_table->get_pagenum();
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
if ( $pagenum > $total_pages && $total_pages > 0 ) {
wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
die();
}
require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php';
}
/**
* @param array