Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions classes/controllers/FrmAddonsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,7 @@ protected static function fill_update_addon_info( $installed_addons ) {
}

$checked_licenses[] = $new_license;

$api = new FrmFormApi( $new_license );
$api = new FrmFormApi( $new_license );

if ( empty( $version_info ) ) {
$version_info = $api->get_api_info();
Expand Down Expand Up @@ -807,10 +806,8 @@ protected static function prepare_addons( &$addons ) {
$slug = str_replace( array( '-wordpress-plugin', '-wordpress' ), '', $addon['slug'] );
$file_name = $addon['plugin'];
} else {
$slug = $id;

$slug = $id;
$base_file = $addon['file'] ?? 'formidable-' . $slug;

$file_name = $base_file . '/' . $base_file . '.php';

if ( ! isset( $addon['plugin'] ) ) {
Expand Down Expand Up @@ -1250,8 +1247,7 @@ protected static function handle_addon_action( $installed, $action ) {
*/
private static function get_addon_activation_response() {
$activating_page = self::get_activating_page();

$message = $activating_page ? __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ) : __( 'Your plugin has been activated.', 'formidable' );
$message = $activating_page ? __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ) : __( 'Your plugin has been activated.', 'formidable' );

return array(
'message' => $message,
Expand Down
3 changes: 1 addition & 2 deletions classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public static function add_admin_class( $classes ) {
private static function get_full_screen_setting() {
global $wpdb;
$meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences';

$prefs = get_user_meta( get_current_user_id(), $meta_key, true );
$prefs = get_user_meta( get_current_user_id(), $meta_key, true );

if ( $prefs && isset( $prefs['core/edit-post']['fullscreenMode'] ) ) {
return $prefs['core/edit-post']['fullscreenMode'];
Expand Down
13 changes: 5 additions & 8 deletions classes/controllers/FrmApplicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ public static function get_applications_data() {
* @return array<array>
*/
private static function get_prepared_template_data() {
$api = new FrmApplicationApi();
$applications = $api->get_api_info();
$applications = array_filter( $applications, 'is_array' );

$api = new FrmApplicationApi();
$applications = $api->get_api_info();
$applications = array_filter( $applications, 'is_array' );
$unlocked_templates = array();
$locked_templates = array();

Expand All @@ -124,8 +123,7 @@ private static function get_prepared_template_data() {
}

$unlocked_templates = self::sort_templates( $unlocked_templates );

$applications = $unlocked_templates;
$applications = $unlocked_templates;

if ( current_user_can( 'administrator' ) || current_user_can( 'frm_change_settings' ) ) {
$locked_templates = self::sort_templates( $locked_templates );
Expand All @@ -144,8 +142,7 @@ private static function get_prepared_template_data() {
* @return array<array>
*/
private static function reduce_template( $total, $current ) {
$template = new FrmApplicationTemplate( $current );

$template = new FrmApplicationTemplate( $current );
$js_object = $template->as_js_object();

if ( $js_object ) {
Expand Down
6 changes: 2 additions & 4 deletions classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ public static function get_dashboard_helper() {
* @return void
*/
public static function route() {
$dashboard_view = self::get_dashboard_helper();

$dashboard_view = self::get_dashboard_helper();
$should_display_videos = is_callable( 'FrmProDashboardHelper::should_display_videos' ) ? FrmProDashboardHelper::should_display_videos() : true;

require FrmAppHelper::plugin_path() . '/classes/views/dashboard/dashboard.php';
Expand Down Expand Up @@ -227,8 +226,7 @@ public static function view_args_build_cta( $title, $link = '#', $display = true
* @return array
*/
private static function view_args_payments() {
$prepared_data = array();

$prepared_data = array();
$model_payments = new FrmTransLitePayment();
$payments = $model_payments->get_payments_stats();

Expand Down
16 changes: 6 additions & 10 deletions classes/controllers/FrmEmailStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,8 @@ private static function get_test_rich_text_email_content( $style_key, $table_row

// Modern and Compact table styles don't have top and bottom border.
$should_remove_top_bottom_border = 'classic' !== $style_key;

$table_generator = self::get_table_generator( $style_key );

$content = $table_generator->generate_table_header();
$table_generator = self::get_table_generator( $style_key );
$content = $table_generator->generate_table_header();

// By default, table has the bottom border and table cells have top border.
if ( $should_remove_top_bottom_border ) {
Expand Down Expand Up @@ -316,10 +314,9 @@ public static function ajax_send_test_email() {
}

$email_style = self::get_default_email_style();

$subject = __( 'Formidable Test Email', 'formidable' );
$content = self::get_test_email_content();
$headers = array(
$subject = __( 'Formidable Test Email', 'formidable' );
$content = self::get_test_email_content();
$headers = array(
self::get_content_type_header( $email_style ),
);

Expand Down Expand Up @@ -395,8 +392,7 @@ public static function get_email_style_settings() {
*/
public static function wrap_email_message( $message ) {
$style_settings = self::get_email_style_settings();

$header_img = '';
$header_img = '';

if ( $style_settings['img'] ) {
$img_align = $style_settings['img_align'] ? $style_settings['img_align'] : 'center';
Expand Down
23 changes: 8 additions & 15 deletions classes/controllers/FrmEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ private static function maybe_redirect_to_views_upsell() {
*/
private static function add_url_params_to_views_redirect_query_args( $query_args ) {
$query_args['show_nav'] = FrmAppHelper::simple_get( 'show_nav', 'absint', 0 );

$form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 );
$form_id = FrmAppHelper::simple_get( 'form', 'absint', 0 );

if ( $form_id ) {
$query_args['form'] = $form_id;
Expand Down Expand Up @@ -187,8 +186,7 @@ public static function manage_columns( $columns ) {
self::maybe_add_ip_col( $form_id, $columns );

$frm_vars['cols'] = $columns;

$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );

if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ), true ) ) {
add_screen_option(
Expand Down Expand Up @@ -584,8 +582,7 @@ private static function remove_excess_cols( $atts, &$result ) {
$atts['form_id'] . '_id' => '',
);
$cols = $remove_first + array_reverse( $frm_vars['cols'], true );

$i = $atts['i'];
$i = $atts['i'];

foreach ( $cols as $col_key => $col ) {
if ( $i <= $atts['max_columns'] ) {
Expand Down Expand Up @@ -620,11 +617,9 @@ public static function display_list( $message = '', $errors = array() ) {
self::get_delete_form_time( $form, $errors );
}

$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );

$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
$wp_list_table = new $table_class( array( 'params' => $params ) );

$pagenum = $wp_list_table->get_pagenum();
$pagenum = $wp_list_table->get_pagenum();

$wp_list_table->prepare_items();

Expand Down Expand Up @@ -926,8 +921,7 @@ public static function show_entry_shortcode( $atts ) {
'array_separator' => ', ',
);
$defaults = apply_filters( 'frm_show_entry_defaults', $defaults );

$atts = shortcode_atts( $defaults, $atts );
$atts = shortcode_atts( $defaults, $atts );

if ( $atts['default_email'] ) {
$shortcode_atts = array(
Expand All @@ -949,9 +943,8 @@ public static function show_entry_shortcode( $atts ) {
* @return void
*/
public static function entry_sidebar( $entry = false ) {
$data = array();
$id = 0;

$data = array();
$id = 0;
Comment thread
Crabcyborg marked this conversation as resolved.
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );

Expand Down
29 changes: 12 additions & 17 deletions classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,12 @@ public static function include_new_field( $field_type, $form_id, $field_options
return false;
}

$field = self::get_field_array_from_id( $field_id );

$field = self::get_field_array_from_id( $field_id );
$values = array();

if ( FrmAppHelper::pro_is_installed() ) {
$values['post_type'] = FrmProFormsHelper::post_type( $form_id );

$parent_form_id = FrmDb::get_var( 'frm_forms', array( 'id' => $form_id ), 'parent_form_id' );
$parent_form_id = FrmDb::get_var( 'frm_forms', array( 'id' => $form_id ), 'parent_form_id' );

if ( $parent_form_id ) {
$field['parent_form_id'] = $parent_form_id;
Expand All @@ -132,9 +130,8 @@ public static function duplicate() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );

$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
$form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' );

$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
$form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' );
$new_field = FrmField::duplicate_single_field( $field_id, $form_id );

if ( is_array( $new_field ) && ! empty( $new_field['field_id'] ) ) {
Expand Down Expand Up @@ -177,9 +174,8 @@ public static function load_single_field( $field_object, $values, $form_id = 0 )
$field_object = FrmField::getOne( $field['id'] );
}

$field_obj = FrmFieldFactory::get_field_factory( $field_object );
$display = self::display_field_options( array(), $field_obj );

$field_obj = FrmFieldFactory::get_field_factory( $field_object );
$display = self::display_field_options( array(), $field_obj );
$ajax_loading = ! empty( $values['ajax_load'] );
$ajax_this_field = isset( $values['count'] ) && $values['count'] > 10 && ! in_array( $field_object->type, array( 'divider', 'end_divider' ), true );

Expand Down Expand Up @@ -277,9 +273,10 @@ public static function import_options() {
}

$field = FrmFieldsHelper::setup_edit_vars( $field );
$opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' );
$opts = explode( "\n", rtrim( $opts, "\n" ) );
$opts = array_map( 'trim', $opts );

$opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' );
$opts = explode( "\n", rtrim( $opts, "\n" ) );
$opts = array_map( 'trim', $opts );

$separate = FrmAppHelper::get_param( 'separate', '', 'post', 'sanitize_text_field' );
$field['separate_value'] = $separate === 'true';
Expand Down Expand Up @@ -637,8 +634,7 @@ private static function add_html_cols( $field, array &$add_html ) {
return;
}

$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];

$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
$add_html['cols'] = 'cols="' . absint( $size ) . '"';
}

Expand Down Expand Up @@ -921,8 +917,7 @@ public static function pull_custom_error_body_from_custom_html( $form, $field, $

$custom_html = $field['custom_html'];
$custom_html = apply_filters( 'frm_before_replace_shortcodes', $custom_html, $field, $errors, $form );

$start = strpos( $custom_html, '[if error]' );
$start = strpos( $custom_html, '[if error]' );

if ( false === $start ) {
return false;
Expand Down
29 changes: 11 additions & 18 deletions classes/controllers/FrmFormActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ private static function maybe_unset_highrise( $action_classes ) {
* @param array $values
*/
public static function email_settings( $values ) {
$form = FrmForm::getOne( $values['id'] );
$groups = self::form_action_groups();

$form = FrmForm::getOne( $values['id'] );
$groups = self::form_action_groups();
$action_controls = self::get_form_actions();
self::maybe_add_action_to_group( $action_controls, $groups );

Expand Down Expand Up @@ -266,9 +265,8 @@ private static function active_actions( $action_controls ) {
* @param array $allowed
*/
public static function show_action_icon_link( $action_control, $allowed ) {
$data = array();
$classes = ' frm_' . $action_control->id_base . '_action frm_single_action';

$data = array();
$classes = ' frm_' . $action_control->id_base . '_action frm_single_action';
$group_class = ' frm-group-' . $action_control->action_options['group'];

/* translators: %s: Name of form action */
Expand Down Expand Up @@ -465,13 +463,11 @@ public static function add_form_action() {
$action_control = self::get_form_actions( $action_type );
$action_control->_set( $action_key );

$form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );

$form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
$form_action = $action_control->prepare_new( $form_id );
$use_logging = self::should_show_log_message( $action_type );

$values = array();
$form = self::fields_to_values( $form_id, $values );
$values = array();
$form = self::fields_to_values( $form_id, $values );

include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
wp_die();
Expand All @@ -481,20 +477,17 @@ public static function fill_action() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );

$action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
$action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );

$action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
$action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
$action_control = self::get_form_actions( $action_type );

if ( ! $action_control ) {
wp_die();
}

$form_action = $action_control->get_single_action( $action_key );

$values = array();
$form = self::fields_to_values( $form_action->menu_order, $values );

$values = array();
$form = self::fields_to_values( $form_action->menu_order, $values );
$use_logging = self::should_show_log_message( $action_type );

include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
Expand Down
Loading