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
3 changes: 2 additions & 1 deletion classes/controllers/FrmAddonsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,11 @@ public static function get_pro_license() {
return '';
}

if ( strpos( $license, '-' ) ) {
if ( str_contains( $license, '-' ) ) {
// this is a fix for licenses saved in the past
$license = strtoupper( $license );
}

return $license;
}

Expand Down
3 changes: 2 additions & 1 deletion classes/controllers/FrmDeactivationFeedbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ public static function set_feedback_expired_date( $plugin ) {
return;
}

if ( ! strpos( $plugin, 'formidable.php' ) && ! strpos( $plugin, 'formidable-pro.php' ) ) {
if ( ! str_contains( $plugin, 'formidable.php' ) && ! str_contains( $plugin, 'formidable-pro.php' ) ) {
return;
}

update_option( 'frm_feedback_expired', gmdate( 'Y-m-d', strtotime( '+ 1 day' ) ) );
}

Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ private static function add_shortcodes_to_html( $field, array &$add_html ) {
continue;
}

if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
if ( is_numeric( $k ) && str_contains( $v, '=' ) ) {
$add_html[] = $v;
} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ private static function should_load_late() {
* @return string
*/
public static function defer_script_loading( $tag, $handle ) {
if ( 'captcha-api' === $handle && ! strpos( $tag, 'defer' ) ) {
if ( 'captcha-api' === $handle && ! str_contains( $tag, 'defer' ) ) {
$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
}

Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ private static function should_use_custom_header_ip() {
* @return mixed
*/
public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
if ( strpos( $param, '[' ) ) {
if ( str_contains( $param, '[' ) ) {
$params = explode( '[', $param );
$param = $params[0];
}
Expand Down Expand Up @@ -1390,7 +1390,7 @@ public static function icon_by_class( $class, $atts = array() ) {
} else {
$class = ! str_contains( $icon, ' ' ) ? '' : ' ' . $icon;

if ( strpos( $icon, ' ' ) ) {
if ( str_contains( $icon, ' ' ) ) {
$icon = explode( ' ', $icon );
$icon = reset( $icon );
}
Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmEmailSummaryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,13 @@ public static function process_inbox_cta_button( $button_html ) {
// Replace link utm.
$button_html = str_replace( 'utm_medium=inbox', 'utm_medium=summary-email', $button_html );

if ( strpos( $button_html, 'style="' ) ) {
if ( str_contains( $button_html, 'style="' ) ) {
// Maybe this button contains inline style.
return $button_html;
}

// Add inline CSS for specific button types.
if ( strpos( $button_html, 'frm-button-primary' ) ) {
if ( str_contains( $button_html, 'frm-button-primary' ) ) {
$button_html = str_replace( '<a', '<a style="' . self::get_button_style() . '"', $button_html );
}

Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmEntriesListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ private function get_column_value( $item, &$val ) {
$sep_val = false;
}

if ( strpos( $col_name, '-_-' ) ) {
if ( str_contains( $col_name, '-_-' ) ) {
list( $col_name, $embedded_field_id ) = explode( '-_-', $col_name );
}

Expand Down
6 changes: 3 additions & 3 deletions classes/helpers/FrmFieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FrmFieldsHelper {
*/
public static function setup_new_vars( $type = '', $form_id = '' ) {

if ( strpos( $type, '|' ) ) {
if ( str_contains( $type, '|' ) ) {
list( $type, $setting ) = explode( '|', $type );
}

Expand Down Expand Up @@ -1333,7 +1333,7 @@ public static function process_get_shortcode( $atts, $return_array = false ) {
return '';
}

if ( strpos( $atts['param'], '&#91;' ) ) {
if ( str_contains( $atts['param'], '&#91;' ) ) {
$atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
$atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
}
Expand Down Expand Up @@ -2378,7 +2378,7 @@ public static function show_add_field_buttons( $args ) {
$install_data = '';
$requires = '';
$link = isset( $field_type['link'] ) ? esc_url_raw( $field_type['link'] ) : '';
$has_show_upgrade_class = isset( $field_type['icon'] ) && strpos( $field_type['icon'], ' frm_show_upgrade' );
$has_show_upgrade_class = isset( $field_type['icon'] ) && str_contains( $field_type['icon'], ' frm_show_upgrade' );
$show_upgrade = $has_show_upgrade_class || str_contains( $args['no_allow_class'], 'frm_show_upgrade' );

if ( $has_show_upgrade_class ) {
Expand Down
10 changes: 5 additions & 5 deletions classes/helpers/FrmFormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public static function get_start_over_shortcode() {
public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) {
$button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values );

if ( ! strpos( $button, '[button_action]' ) ) {
if ( ! str_contains( $button, '[button_action]' ) ) {
echo FrmAppHelper::maybe_kses( $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
return;
}
Expand Down Expand Up @@ -931,7 +931,7 @@ public static function replace_shortcodes( $html, $form, $title = false, $descri
// Replace [frmurl].
$html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html );

if ( strpos( $html, '[button_label]' ) ) {
if ( str_contains( $html, '[button_label]' ) ) {
add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
$submit_label = apply_filters( 'frm_submit_button', $title, $form );
$submit_label = esc_attr( do_shortcode( $submit_label ) );
Expand All @@ -940,15 +940,15 @@ public static function replace_shortcodes( $html, $form, $title = false, $descri

$html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values );

if ( strpos( $html, '[if back_button]' ) ) {
if ( str_contains( $html, '[if back_button]' ) ) {
$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
}

if ( strpos( $html, '[if save_draft]' ) ) {
if ( str_contains( $html, '[if save_draft]' ) ) {
$html = preg_replace( '/(\[if\s+save_draft\])(.*?)(\[\/if\s+save_draft\])/mis', '', $html );
}

if ( strpos( $html, '[if start_over]' ) ) {
if ( str_contains( $html, '[if start_over]' ) ) {
$html = preg_replace( '/(\[if\s+start_over\])(.*?)(\[\/if\s+start_over\])/mis', '', $html );
}

Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmXMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ private static function format_email_to_data( &$atts, $notification ) {
$atts['email_to'][ $key ] = '[' . $email_field . ']';
}

if ( strpos( $email_field, '|' ) ) {
if ( str_contains( $email_field, '|' ) ) {
Comment thread
Crabcyborg marked this conversation as resolved.
$email_opt = explode( '|', $email_field );

if ( isset( $email_opt[0] ) ) {
Expand Down Expand Up @@ -2355,7 +2355,7 @@ private static function migrate_autoresponder_to_action( $form_options, $form_id

$email_field = $form_options['ar_email_to'] ?? 0;

if ( strpos( $email_field, '|' ) ) {
if ( str_contains( $email_field, '|' ) ) {
// data from entries field
$email_field = explode( '|', $email_field );

Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmCreateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private function get_ftp_creds( $type ) {
// Strip any schemes off.
$credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] );

if ( strpos( $credentials['hostname'], ':' ) ) {
if ( str_contains( $credentials['hostname'], ':' ) ) {
list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 );

if ( ! is_numeric( $credentials['port'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ private function format_from( $from ) {
}

// if sending the email from a yahoo address, change it to the WordPress default
if ( strpos( $from_email, '@yahoo.com' ) ) {
if ( str_contains( $from_email, '@yahoo.com' ) ) {

// Get the site domain and get rid of www.
$sitename = strtolower( FrmAppHelper::get_server_value( 'SERVER_NAME' ) );
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntryMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ function ( $total, $current ) {
$user_where = $wpdb->prepare( ' AND e.user_id=%d', $args['user_id'] );
}

if ( strpos( $where, ' GROUP BY ' ) ) {
if ( str_contains( $where, ' GROUP BY ' ) ) {
Comment thread
Crabcyborg marked this conversation as resolved.
// don't inject WHERE filtering after GROUP BY
$parts = explode( ' GROUP BY ', $where );
$where = $parts[0];
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntryValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ private static function is_akismet_guest_info_value( $key, &$value, $field_id, $

switch ( $key ) {
case 'comment_author_email':
return strpos( $value, '@' ) && is_email( $value );
return str_contains( $value, '@' ) && is_email( $value );

case 'comment_author_url':
return str_starts_with( $value, 'http' );
Expand Down
6 changes: 3 additions & 3 deletions classes/models/FrmFieldFormHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private function add_element_id( $param, $id ) {
}

if ( is_string( $inner_html[2] ) ) {
$has_id = strpos( $inner_html[2], ' id=' );
$has_id = str_contains( $inner_html[2], ' id=' );

if ( ! $has_id ) {
$id = 'frm_' . $id . '_' . $this->html_id;
Expand Down Expand Up @@ -407,7 +407,7 @@ private function filter_for_more_shortcodes() {
* @return void
*/
public function remove_collapse_shortcode( &$html ) {
if ( strpos( $html, '[collapse_this]' ) ) {
if ( str_contains( $html, '[collapse_this]' ) ) {
$html = str_replace( '[collapse_this]', '', $html );
}
}
Expand Down Expand Up @@ -543,7 +543,7 @@ private function get_field_div_classes() {
$extra_classes = $this->field_obj->get_field_column( 'classes' );

if ( ! empty( $extra_classes ) ) {
if ( ! strpos( $this->html, 'frm_form_field ' ) ) {
if ( ! str_contains( $this->html, 'frm_form_field ' ) ) {
$classes .= ' frm_form_field';
}

Expand Down
6 changes: 3 additions & 3 deletions classes/models/FrmMigrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ private function migrate_data( $old_db_version ) {
$old_db_version = get_option( 'frm_db_version' );
}

if ( strpos( $old_db_version, '-' ) ) {
if ( str_contains( $old_db_version, '-' ) ) {
$last_upgrade = explode( '-', $old_db_version );
$old_db_version = (int) $last_upgrade[1];
}
Expand Down Expand Up @@ -667,7 +667,7 @@ private function revert_widget_field_size() {
* @return void
*/
private function maybe_convert_migrated_size( &$size ) {
$has_px_size = ! empty( $size ) && strpos( $size, 'px' );
$has_px_size = ! empty( $size ) && str_contains( $size, 'px' );

if ( ! $has_px_size ) {
return;
Expand Down Expand Up @@ -866,7 +866,7 @@ private function migrate_to_11() {
if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
$form->options['submit_html'] = $new_default_html;
$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
} elseif ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
} elseif ( ! str_contains( $form->options['submit_html'], 'save_draft' ) ) {
$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/fields/FrmFieldNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function check_value_is_valid_with_step( $value, $step ) {
* @return void
*/
private function remove_commas_from_number( &$args ) {
if ( strpos( $args['value'], ',' ) ) {
if ( str_contains( $args['value'], ',' ) ) {
$args['value'] = str_replace( ',', '', $args['value'] );
FrmEntriesHelper::set_posted_value( $this->field, $args['value'], $args );
}
Expand Down
2 changes: 1 addition & 1 deletion formidable.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function frm_class_autoloader( $class_name, $filepath ) {
} else {
$filepath .= 'models/';

if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) {
if ( str_contains( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) {
$filepath .= 'fields/';
}
}
Expand Down
2 changes: 1 addition & 1 deletion stripe/models/FrmStrpLiteAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static function check_html_for_form_id_match( $html ) {
foreach ( self::$form_ids as $form_id ) {
$substring = '<input type="hidden" name="form_id" value="' . $form_id . '"';

if ( strpos( $html, $substring ) ) {
if ( str_contains( $html, $substring ) ) {
return $form_id;
}
}
Expand Down
Loading