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
2 changes: 1 addition & 1 deletion classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static function load_wp_admin_style() {
public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );

if ( empty( $show_nav ) || ! $form ) {
if ( ! $show_nav || ! $form ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static function view_args_build_counter( $heading, $cta = array(), $value
'type' => 'default',
);

if ( ! empty( $cta ) ) {
if ( $cta ) {
$counter_args['cta'] = $cta;
}

Expand Down
10 changes: 5 additions & 5 deletions classes/controllers/FrmEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_v
return $check;
}

if ( empty( $prev_value ) ) {
if ( ! $prev_value ) {
$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
}

Expand Down Expand Up @@ -438,7 +438,7 @@ private static function hidden_column_key( $menu_name = '' ) {
* @return string
*/
private static function base_column_key( $menu_name = '' ) {
if ( empty( $menu_name ) ) {
if ( ! $menu_name ) {
$menu_name = FrmAppHelper::get_menu_name();
}

Expand Down Expand Up @@ -592,7 +592,7 @@ private static function remove_excess_cols( $atts, &$result ) {
break;
}

if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
if ( ! $result || ! in_array( $col_key, $result, true ) ) {
$result[] = $col_key;
--$i;
}
Expand Down Expand Up @@ -641,7 +641,7 @@ public static function display_list( $message = '', $errors = array() ) {
die();
}

if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
if ( ! $message && isset( $_GET['import-message'] ) ) {
$message = __( 'Your import is complete', 'formidable' );
}

Expand Down Expand Up @@ -794,7 +794,7 @@ public static function process_entry( $errors = '', $ajax = false ) {

$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );

if ( empty( $errors ) ) {
if ( ! $errors ) {
$_POST['frm_skip_cookie'] = 1;
$do_success = false;

Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function create() {
public static function include_new_field( $field_type, $form_id, $field_options = array() ) {
$field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id );

if ( ! empty( $field_options ) ) {
if ( $field_options ) {
$field_values['field_options'] = array_merge( $field_values['field_options'], $field_options );
}
Comment thread
Crabcyborg marked this conversation as resolved.

Expand Down
6 changes: 3 additions & 3 deletions classes/controllers/FrmFormActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public static function get_form_actions( $action = 'all' ) {
* @return void
*/
public static function list_actions( $form, $values ) {
if ( empty( $form ) ) {
if ( ! $form ) {
return;
}

Expand Down Expand Up @@ -611,7 +611,7 @@ public static function update_settings( $form_id ) {
* @return void
*/
public static function delete_missing_actions( $old_actions ) {
if ( ! empty( $old_actions ) ) {
if ( $old_actions ) {
foreach ( $old_actions as $old_id ) {
wp_delete_post( $old_id );
}
Expand Down Expand Up @@ -696,7 +696,7 @@ public static function trigger_actions( $event, $form, $entry, $type = 'all', $a
$entry = FrmEntry::getOne( $entry, true );
}

if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
if ( ! $entry || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private static function antispam_was_on( $form_id ) {
* @return void
*/
public static function update( $values = array() ) {
if ( empty( $values ) ) {
if ( ! $values ) {
$values = $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Missing
}

Expand Down Expand Up @@ -2485,7 +2485,7 @@ public static function show_form( $id = '', $key = '', $title = false, $descript
private static function maybe_get_form_to_show( $id ) {
$form = false;

if ( ! empty( $id ) ) {
if ( $id ) {
// Form id or key is set.
$form = FrmForm::getOne( $id );

Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ public static function do_accordion_sections( $screen, $context, $data_object )

wp_enqueue_script( 'accordion' );

if ( empty( $screen ) ) {
if ( ! $screen ) {
$screen = get_current_screen();
} elseif ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmXMLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private static function override_url( $form, &$url ) {
* @return string
*/
private static function get_selected_in_form( $form, $value = 'form' ) {
if ( ! empty( $form ) && ! empty( $form[ $value ] ) ) {
if ( $form && ! empty( $form[ $value ] ) ) {
return $form[ $value ];
}

Expand Down
16 changes: 8 additions & 8 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ public static function decode_specialchars( &$value ) {
*/
private static function decode_amp( &$string ) {
// Don't bother if there are no entities - saves a lot of processing
if ( empty( $string ) || ! str_contains( $string, '&' ) ) {
if ( ! $string || ! str_contains( $string, '&' ) ) {
return;
}

Expand Down Expand Up @@ -1155,7 +1155,7 @@ private static function allowed_html( $allowed ) {

if ( $allowed === 'all' ) {
$allowed_html = $html;
} elseif ( ! empty( $allowed ) ) {
} elseif ( $allowed ) {
foreach ( (array) $allowed as $a ) {
$allowed_html[ $a ] = $html[ $a ] ?? array();
}
Expand Down Expand Up @@ -2406,15 +2406,15 @@ public static function permission_check( $permission, $show_message = 'show' ) {
* @return false|string The permission message or false if allowed
*/
public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
if ( $permission && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
$frm_settings = self::get_settings();

return $frm_settings->admin_permission;
}

$error = false;

if ( empty( $nonce_name ) ) {
if ( ! $nonce_name ) {
return $error;
}

Expand Down Expand Up @@ -2849,7 +2849,7 @@ public static function setup_edit_vars( $record, $table, $fields = '', $default
return false;
}

if ( empty( $post_values ) ) {
if ( ! $post_values ) {
$post_values = wp_unslash( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
}

Expand Down Expand Up @@ -2888,7 +2888,7 @@ public static function setup_edit_vars( $record, $table, $fields = '', $default
* @return void
*/
private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
if ( ! empty( $fields ) ) {
if ( $fields ) {
foreach ( (array) $fields as $field ) {
if ( ! self::is_admin_page() ) {
// Don't prep default values on the form settings page.
Expand Down Expand Up @@ -3058,7 +3058,7 @@ private static function fill_form_defaults( $post_values, array &$values ) {
* @return bool|int
*/
public static function custom_style_value( $post_values ) {
if ( ! empty( $post_values ) && isset( $post_values['options']['custom_style'] ) ) {
if ( $post_values && isset( $post_values['options']['custom_style'] ) ) {
return absint( $post_values['options']['custom_style'] );
}

Expand Down Expand Up @@ -3578,7 +3578,7 @@ public static function select_current_page( $page, $current_page, $action = arra
$frm_action = 'reports';
}

if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action, true ) ) ) {
if ( ! $action || ( ! empty( $frm_action ) && in_array( $frm_action, $action, true ) ) ) {
echo ' class="current_page"';
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmDashboardHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function get_free_templates_banner() {
* @return void
*/
public static function show_connect_links( $buttons = array(), $button_classes = '' ) {
if ( empty( $buttons ) ) {
if ( ! $buttons ) {
$buttons = self::get_license_buttons();
}

Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmFieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2746,7 +2746,7 @@ public static function render_ai_generate_options_button( $args, $should_hide_bu
'class' => self::get_ai_generate_options_button_class(),
);

if ( ! empty( $should_hide_bulk_edit ) ) {
if ( $should_hide_bulk_edit ) {
$attributes['class'] .= ' frm-force-hidden';
}

Expand Down
8 changes: 4 additions & 4 deletions classes/helpers/FrmFormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static function forms_dropdown( $field_name, $field_value = '', $args = a
* @return void
*/
public static function add_html_attr( $class, $param, &$add_html ) {
if ( ! empty( $class ) ) {
if ( $class ) {
$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
}
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public static function get_success_message( $atts ) {
public static function setup_new_vars( $values = array() ) {
global $wpdb;

if ( ! empty( $values ) ) {
if ( $values ) {
$post_values = $values;
} else {
$values = array();
Expand Down Expand Up @@ -1114,7 +1114,7 @@ private static function field_has_top_label( $field, $form ) {
public static function get_form_style( $form ) {
$style = 1;

if ( empty( $form ) || 'default' === $form ) {
if ( ! $form || 'default' === $form ) {
return $style;
}

Expand Down Expand Up @@ -1356,7 +1356,7 @@ public static function delete_trash_link( $id, $status, $length = 'label' ) {
public static function format_link_html( $link_details, $length = 'label' ) {
$link = '';

if ( ! empty( $link_details ) ) {
if ( $link_details ) {
$link = '<a href="' . esc_url( $link_details['url'] ) . '" class="frm-trash-link"';

if ( isset( $link_details['data'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmStylesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public static function get_css_vars( $vars = array() ) {
* @return void
*/
public static function output_vars( $settings, $defaults = array(), $vars = array() ) {
if ( empty( $vars ) ) {
if ( ! $vars ) {
$vars = self::get_css_vars( array_keys( $settings ) );
}

Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmXMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ private static function get_form_fields( $form_id ) {
* @return void
*/
private static function delete_removed_fields( $form_fields ) {
if ( ! empty( $form_fields ) ) {
if ( $form_fields ) {
foreach ( $form_fields as $field ) {
if ( is_object( $field ) ) {
FrmField::destroy( $field->id );
Expand Down Expand Up @@ -500,7 +500,7 @@ private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$
self::maybe_update_get_values_form_setting( $imported, $f );
self::migrate_placeholders( $f );

if ( ! empty( $this_form ) ) {
if ( $this_form ) {
// check for field to edit by field id
if ( isset( $form_fields[ $f['id'] ] ) ) {
FrmField::update( $f['id'], $f );
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmCreateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function get_file_contents() {
private function get_contents( $file = '' ) {
global $wp_filesystem;

if ( empty( $file ) ) {
if ( ! $file ) {
$file = $this->new_file_path;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ private static function convert_options_to_array( &$args, $order_by = '', $limit
$args = array( 'order_by' => $args );
}

if ( ! empty( $order_by ) ) {
if ( $order_by ) {
$args['order_by'] = $order_by;
}

if ( ! empty( $limit ) ) {
if ( $limit ) {
$args['limit'] = $limit;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public static function get_new_entry_name( $values, $default = '' ) {
public static function maybe_get_entry( &$entry ) {
if ( $entry && is_numeric( $entry ) ) {
$entry = self::getOne( $entry );
} elseif ( empty( $entry ) || 'false' === $entry ) {
} elseif ( ! $entry || 'false' === $entry ) {
$entry = false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions classes/models/FrmEntryValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static function get_fields_to_validate( $values, $exclude ) {
$where['fr.parent_form_id'] = array( null, 0 );

// Don't get excluded fields (like file upload fields in the ajax validation)
if ( ! empty( $exclude ) ) {
if ( $exclude ) {
$where['fi.type not'] = $exclude;
}

Expand Down Expand Up @@ -523,7 +523,7 @@ private static function create_regular_expression_from_format( $pattern ) {
$pattern = '';

foreach ( $parts as $part ) {
if ( empty( $pattern ) ) {
if ( ! $pattern ) {
$pattern .= $part;
} else {
$pattern .= '(' . $part . ')?';
Expand All @@ -549,7 +549,7 @@ public static function spam_check( $exclude, $values, &$errors ) {
return;
}

if ( ! empty( $exclude ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
if ( $exclude || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
// only check spam if there are no other errors
return;
}
Expand Down
6 changes: 3 additions & 3 deletions classes/models/FrmField.php
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc
break;
}

if ( ! empty( $limit ) && $count >= $limit ) {
if ( $limit && $count >= $limit ) {
break;
}

Expand Down Expand Up @@ -972,7 +972,7 @@ public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'ex
++$count;
$fields[ $result->id ] = $result;

if ( ! empty( $limit ) && $count >= $limit ) {
if ( $limit && $count >= $limit ) {
break;
}
}
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $b
$form_table_name = $wpdb->prefix . 'frm_forms';
}

if ( ! empty( $order_by ) && ! str_contains( $order_by, 'ORDER BY' ) ) {
if ( $order_by && ! str_contains( $order_by, 'ORDER BY' ) ) {
Comment thread
Crabcyborg marked this conversation as resolved.
$order_by = ' ORDER BY ' . $order_by;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmFormApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected function skip_categories() {
* @return array
*/
public function get_addon_for_license( $license_plugin, $addons = array() ) {
if ( empty( $addons ) ) {
if ( ! $addons ) {
$addons = $this->get_api_info();
}

Expand Down Expand Up @@ -409,7 +409,7 @@ public function error_for_license() {
* @return array
*/
public function get_error_from_response( $addons = array() ) {
if ( empty( $addons ) ) {
if ( ! $addons ) {
$addons = $this->get_api_info();
}

Expand Down
Loading
Loading