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
4 changes: 2 additions & 2 deletions classes/helpers/FrmFieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ public static function &label_position( $position, $field, $form ) {
}

$position = FrmStylesController::get_style_val( 'position', $form );
if ( $position == 'none' ) {
if ( $position === 'none' ) {
$position = 'top';
} elseif ( $position == 'no_label' ) {
} elseif ( $position === 'no_label' ) {
$position = 'none';
} elseif ( $position === 'inside' && ! self::is_placeholder_field_type( $field['type'] ) ) {
$position = 'top';
Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmFormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ public static function submit_button_label( $submit ) {
*/
public static function maybe_hide_inline() {
$frm_settings = FrmAppHelper::get_settings();
if ( $frm_settings->load_style == 'none' ) {
if ( $frm_settings->load_style === 'none' ) {
echo ' style="display:none;"';
} elseif ( $frm_settings->load_style === 'dynamic' ) {
FrmStylesController::enqueue_style();
Expand Down
10 changes: 5 additions & 5 deletions classes/models/FrmDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static function interpret_array_to_sql( $key, $value, &$where, &$values
*/
$start = '%';
$end = '%';
if ( $lowercase_key == 'like%' ) {
if ( $lowercase_key === 'like%' ) {
$start = '';
$where = rtrim( $where, '%' );
} elseif ( $lowercase_key == '%like' ) {
Expand All @@ -152,7 +152,7 @@ private static function interpret_array_to_sql( $key, $value, &$where, &$values
$where .= ' IS NULL';
} else {
// allow a - to prevent = from being added
if ( substr( $key, - 1 ) == '-' ) {
if ( substr( $key, - 1 ) === '-' ) {
$where = rtrim( $where, '-' );
} else {
$where .= '=';
Expand Down Expand Up @@ -319,7 +319,7 @@ public static function append_where_is( $where_is ) {
}

// > and < need a little more work since we don't want them switched to >= and <=
if ( $where_is == '>' || $where_is == '<' ) {
if ( $where_is === '>' || $where_is === '<' ) {
// The - indicates that the = should not be added later.
return ' ' . $where_is . '-';
}
Expand Down Expand Up @@ -459,9 +459,9 @@ private static function generate_query_string_from_pieces( $columns, $table, $wh
*/
private static function esc_query_args( &$args ) {
foreach ( $args as $param => $value ) {
if ( $param == 'order_by' ) {
if ( $param === 'order_by' ) {
$args[ $param ] = self::esc_order( $value );
} elseif ( $param == 'limit' ) {
} elseif ( $param === 'limit' ) {
$args[ $param ] = self::esc_limit( $value );
}

Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntryFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ protected function init_atts( $atts ) {
* @return int|string
*/
protected function get_key_or_id( $field_value ) {
return $this->array_key == 'key' ? $field_value->get_field_key() : $field_value->get_field_id();
return $this->array_key === 'key' ? $field_value->get_field_key() : $field_value->get_field_id();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntryMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public static function search_entry_metas( $search, $field_id, $operator ) {
$where .= $wpdb->prepare( ' field_id=%d', $field_id );
$query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmDb::prepend_and_or_where( ' WHERE ', $where );
} else {
if ( $operator == 'LIKE' ) {
if ( $operator === 'LIKE' ) {
$search = '%' . $search . '%';
}
$query = $wpdb->prepare( "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmField.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '', $b
$limit = FrmDb::esc_limit( $limit );

$query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id";
$query_type = $limit == ' LIMIT 1' || $limit == 1 ? 'row' : 'results';
$query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The review comment is valid. The line in question still uses the == operator for the second condition, which should be replaced with === to enhance type safety.

  • Line 930: query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results';
Analysis chain

The use of strict equality checks (===) is not visible in the provided code segment. Please ensure that the changes related to the PR's objectives are included in the provided code for review.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the presence of strict equality checks in FrmField.php.

# Test: Search for strict equality checks. Expect: At least one occurrence of `===`.
rg --type php '===' classes/models/FrmField.php

Length of output: 1211


if ( is_array( $where ) ) {
$args = array(
Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
}
}

if ( $limit == ' LIMIT 1' || $limit == 1 ) {
if ( $limit === ' LIMIT 1' || $limit == 1 ) {
// return the first form object if we are only getting one form
$results = reset( $results );
}
Expand All @@ -881,7 +881,7 @@ public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) {
$query['is_template'] = 0;
$query['status'] = array( null, '', 'published' );
if ( $inc_children == 'exclude' ) {
if ( $inc_children === 'exclude' ) {
$query['parent_form_id'] = array( null, 0 );
}

Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmMigrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ private function migrate_to_25() {
}

foreach ( $styles as $style ) {
if ( $style->post_content['field_width'] == '400px' ) {
if ( $style->post_content['field_width'] === '400px' ) {
$style->post_content['field_width'] = '100%';
$frm_style->save( (array) $style );

Expand Down
2 changes: 1 addition & 1 deletion classes/views/addons/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$license = $plugin->license;
$status = get_option( $plugin->option_name . 'active' );
$activate = false !== $license && $status == 'valid' ? 'deactivate' : 'activate';
$activate = false !== $license && $status === 'valid' ? 'deactivate' : 'activate';
$icon_class = empty( $license ) ? 'frm_hidden' : '';
?>

Expand Down
2 changes: 1 addition & 1 deletion classes/views/styles/_sample_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
die( 'You are not allowed to call this page directly.' );
}

$pos_class = 'frm_' . ( $style->post_content['position'] == 'none' ? 'top' : ( $style->post_content['position'] == 'no_label' ? 'none' : $style->post_content['position'] ) ) . '_container';
$pos_class = 'frm_' . ( $style->post_content['position'] === 'none' ? 'top' : ( $style->post_content['position'] === 'no_label' ? 'none' : $style->post_content['position'] ) ) . '_container';
?>
<div class="frm_forms with_frm_style frm_style_<?php echo esc_attr( $style->post_name ); ?> <?php echo esc_attr( FrmAppHelper::pro_is_installed() ? 'frm_pro_form' : 'frm_lite_form' ); ?>">
<div class="frm-show-form">
Expand Down
2 changes: 1 addition & 1 deletion stripe/controllers/FrmTransLiteActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static function prepare_amount( $amount, $atts = array() ) {
$amount = FrmTransLiteAppHelper::process_shortcodes( $atts );
}

if ( is_string( $amount ) && strlen( $amount ) >= 2 && $amount[0] == '[' && substr( $amount, -1 ) == ']' ) {
if ( is_string( $amount ) && strlen( $amount ) >= 2 && $amount[0] === '[' && substr( $amount, -1 ) === ']' ) {
// Make sure we don't use a field id as the amount.
$amount = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/emails/test_FrmEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public function test_trigger_email_five() {
// From
$this->email_action->post_content['from'] = '"Yahoo" test@yahoo.com';
$sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) );
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
if ( substr( $sitename, 0, 4 ) === 'www.' ) {
$sitename = substr( $sitename, 4 );
}
$expected['from'] = 'Yahoo <wordpress@' . $sitename . '>';
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/forms/test_FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function test_front_head() {
global $wp_scripts;
$formidable_js = $wp_scripts->registered['formidable'];

if ( FrmAppHelper::js_suffix() == '.min' ) {
if ( FrmAppHelper::js_suffix() === '.min' ) {
$file = 'frm.min.js';
if ( strpos( $formidable_js->src, $file ) === false ) {
$file = 'formidable.min.js';
Expand Down