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
1 change: 1 addition & 0 deletions classes/controllers/FrmEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $met
$save = false;

foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
// Don't add blank cols or process included cols.
continue;
Expand Down
5 changes: 3 additions & 2 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ public static function user_has_permission( $needed_role ) {

$can = self::current_user_can( $needed_role );

if ( $can || in_array( $needed_role, array( '-1', 'loggedout' ) ) ) {
if ( $can || in_array( $needed_role, array( '-1', 'loggedout' ), true ) ) {
return $can;
}

Expand Down Expand Up @@ -2447,6 +2447,7 @@ public static function check_selected( $values, $current ) {

$current = is_null( $current ) ? '' : htmlspecialchars_decode( trim( $current ) );

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
}

Expand Down Expand Up @@ -3565,7 +3566,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 ) ) ) {
if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action, true ) ) ) {
echo ' class="current_page"';
}
}
Expand Down
1 change: 1 addition & 0 deletions classes/helpers/FrmEntriesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ public static function set_other_validation_val( &$value, $other_vals, $field, &

// Multi-select dropdown.
if ( is_array( $value ) ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$o_key = array_search( $field->options[ $other_key ], $value );

if ( $o_key !== false ) {
Expand Down
4 changes: 4 additions & 0 deletions classes/helpers/FrmFieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ public static function show_single_option( $field ) {

$field_name = $base_name . ( $default_type === 'checkbox' ? '[' . $opt_key . ']' : '' );

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$checked = ( isset( $field['default_value'] ) && ( ( ! is_array( $field['default_value'] ) && $field['default_value'] == $field_val ) || ( is_array( $field['default_value'] ) && in_array( $field_val, $field['default_value'] ) ) ) );

// If this is an "Other" option, get the HTML for it.
Expand Down Expand Up @@ -952,9 +953,11 @@ public static function array_value_condition( $observed_value, $cond, $hide_opt
$m = array_intersect( $hide_opt, $observed_value );
$m = $m !== array();
} else {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$m = in_array( $hide_opt, $observed_value );
}
} elseif ( $cond === '!=' ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$m = ! in_array( $hide_opt, $observed_value );
} elseif ( $cond === '>' ) {
$min = min( $observed_value );
Expand Down Expand Up @@ -1587,6 +1590,7 @@ public static function get_other_val( $args ) {

// Multi-select dropdowns - key is not preserved
if ( is_array( $field['value'] ) ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$o_key = array_search( $temp_val, $field['value'] );

if ( isset( $field['value'][ $o_key ] ) ) {
Expand Down
1 change: 1 addition & 0 deletions classes/helpers/FrmFormMigratorsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ private static function is_dismissed( $form, $dismissed = null ) {
if ( $dismissed === null ) {
$dismissed = get_option( 'frm_dismissed' );
}
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return ! empty( $dismissed ) && in_array( $form['class'], $dismissed );
}

Expand Down
2 changes: 2 additions & 0 deletions classes/helpers/FrmListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ public function print_column_headers( $with_id = true ) {
$aria_sort_attr = '';
$order_text = '';

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( in_array( $column_key, $hidden ) ) {
$class[] = 'hidden';
}
Expand Down Expand Up @@ -1229,6 +1230,7 @@ protected function single_row_columns( $item ) {
$classes .= ' has-row-actions column-primary';
}

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( in_array( $column_name, $hidden ) ) {
$classes .= ' hidden';
}
Expand Down
5 changes: 3 additions & 2 deletions classes/helpers/FrmStylesPreviewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public static function disable_conflicting_wp_admin_css( $styles ) {
$styles->remove( 'edit' );

$wp_admin_dependencies = $styles->registered['wp-admin']->deps;
$edit_key = array_search( 'edit', $wp_admin_dependencies );
$edit_key = array_search( 'edit', $wp_admin_dependencies, true );

if ( false === $edit_key ) {
return;
Expand Down Expand Up @@ -389,7 +389,8 @@ public static function get_additional_preview_style( $settings, $is_preview = fa
*/
private static function remove_wp_admin_dependency( $styles, $key ) {
$dependencies = $styles->registered['wp-admin']->deps;
$index = array_search( $key, $dependencies );
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$index = array_search( $key, $dependencies );

if ( false === $index ) {
return;
Expand Down
2 changes: 2 additions & 0 deletions classes/helpers/FrmXMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2052,9 +2052,11 @@ private static function switch_action_field_ids( $post_content, $basic_fields, $

// Do a str_replace with each item to set the new IDs
foreach ( $post_content as $key => $setting ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
// Replace old IDs with new IDs
$post_content[ $key ] = str_replace( $old, $new, $setting );
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
} elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
foreach ( $setting as $k => $val ) {
// Replace old IDs with new IDs
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ protected function update_pro_capabilities() {
}

foreach ( $roles as $role => $details ) {
if ( in_array( $role, $cap_roles ) ) {
if ( in_array( $role, $cap_roles, true ) ) {
$wp_roles->add_cap( $role, $cap );
} else {
$wp_roles->remove_cap( $role, $cap );
Expand Down
3 changes: 2 additions & 1 deletion classes/models/FrmDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public static function parse_where_from_array( $args, $base_where, &$where, &$va
}

foreach ( $args as $key => $value ) {
$where .= empty( $where ) ? $base_where : $condition;
$where .= empty( $where ) ? $base_where : $condition;
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );

if ( is_numeric( $key ) || $array_inc_null ) {
Expand Down
1 change: 1 addition & 0 deletions classes/models/FrmEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ private static function before_update_entry( $id, &$values, $update_type ) {

global $frm_vars;

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( isset( $frm_vars['saved_entries'] ) && is_array( $frm_vars['saved_entries'] ) && in_array( (int) $id, $frm_vars['saved_entries'] ) ) {
$update = false;
}
Expand Down
1 change: 1 addition & 0 deletions classes/models/FrmEntryMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public static function update_entry_metas( $entry_id, $values ) {

self::get_value_to_save( compact( 'field', 'field_id', 'entry_id' ), $meta_value );

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( $previous_field_ids && in_array( $field_id, $previous_field_ids ) ) {
Comment thread
Crabcyborg marked this conversation as resolved.

if ( $meta_value === array() || ( ! is_array( $meta_value ) && trim( $meta_value ) === '' ) ) {
Expand Down
1 change: 1 addition & 0 deletions classes/models/FrmEntryValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ protected function is_field_included( $field ) {
* @return bool
*/
protected function is_field_in_array( $field, $array ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
return in_array( $field->id, $array ) || in_array( (string) $field->field_key, $array, true );
Comment thread
Crabcyborg marked this conversation as resolved.
}

Expand Down
3 changes: 2 additions & 1 deletion classes/models/FrmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public static function update( $id, $values, $create_link = false ) {
$new_values = self::set_update_options( array(), $values, array( 'form_id' => $id ) );

foreach ( $values as $value_key => $value ) {
if ( $value_key && in_array( $value_key, $form_fields ) ) {
if ( $value_key && in_array( $value_key, $form_fields, true ) ) {
$new_values[ $value_key ] = $value;
}
}
Expand Down Expand Up @@ -357,6 +357,7 @@ public static function update_fields( $id, $values ) {
$existing_keys = array_keys( $values['item_meta'] );

foreach ( $all_fields as $fid ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
$values['item_meta'][ $fid->id ] = '';
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFormAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected function get_group( $action_options ) {
$group = $this->id_base;
} else {
foreach ( $groups as $name => $check_group ) {
if ( isset( $check_group['actions'] ) && in_array( $this->id_base, $check_group['actions'] ) ) {
if ( isset( $check_group['actions'] ) && in_array( $this->id_base, $check_group['actions'], true ) ) {
$group = $name;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions classes/models/FrmFormMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,12 @@ private function is_imported( $source_id ) {
$imported = $this->get_tracked_import();
$new_form_id = 0;

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) {
return $new_form_id;
}

// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );

if ( $new_form_id && ! FrmForm::get_key_by_id( $new_form_id ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ private function update_roles( $params ) {
}

foreach ( $roles as $role => $details ) {
if ( in_array( $role, $this->$frm_role ) ) {
if ( in_array( $role, $this->$frm_role, true ) ) {
$wp_roles->add_cap( $role, $frm_role );
} else {
$wp_roles->remove_cap( $role, $frm_role );
Expand Down
1 change: 1 addition & 0 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,7 @@ protected function get_new_child_ids( $value, $atts ) {
* @return array
*/
protected function get_multi_opts_for_import( $value ) {
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
if ( ! $this->field || ! $value || in_array( $value, (array) $this->field->options ) ) {
return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/views/frm-form-actions/_action_inside.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

foreach ( $action_control->action_options['event'] as $event ) {
?>
<option value="<?php echo esc_attr( $event ); ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo esc_html( $event_labels[ $event ] ?? $event ); ?></option>
<option value="<?php echo esc_attr( $event ); ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'], true ) ? ' selected="selected"' : ''; ?> ><?php echo esc_html( $event_labels[ $event ] ?? $event ); ?></option>
<?php } ?>
</select>
</p>
Expand Down
4 changes: 4 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@
<severity>8</severity>
<type>error</type>
</rule>
<rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">
<severity>8</severity>
<type>error</type>
</rule>

<!-- Custom Formidable sniffs -->
<rule ref="Formidable.WhiteSpace.BlankLineAfterClosingBrace" />
Expand Down
5 changes: 3 additions & 2 deletions stripe/helpers/FrmTransLiteListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private function get_form_ids() {
private function get_row_classes( $atts ) {
$class = 'column-' . $atts['column_name'];

if ( in_array( $atts['column_name'], $atts['hidden'] ) ) {
if ( in_array( $atts['column_name'], $atts['hidden'], true ) ) {
$class .= ' frm_hidden';
}

Expand Down Expand Up @@ -485,7 +485,8 @@ private function supports_edit_link() {
* @return string
*/
private function get_item_id_column( $item ) {
$entry_id = (int) $item->item_id;
$entry_id = (int) $item->item_id;
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
$entry_is_deleted = ! in_array( $entry_id, $this->valid_entry_ids );

if ( $entry_is_deleted ) {
Expand Down