diff --git a/classes/controllers/FrmAddonsController.php b/classes/controllers/FrmAddonsController.php
index 4ac16dd37d..b54159f874 100644
--- a/classes/controllers/FrmAddonsController.php
+++ b/classes/controllers/FrmAddonsController.php
@@ -29,13 +29,13 @@ class FrmAddonsController {
* @since 6.15
*/
public static function load_admin_hooks() {
- add_action( 'admin_menu', __CLASS__ . '::menu', 100 );
- add_filter( 'pre_set_site_transient_update_plugins', __CLASS__ . '::check_update' );
+ add_action( 'admin_menu', self::class . '::menu', 100 );
+ add_filter( 'pre_set_site_transient_update_plugins', self::class . '::check_update' );
if ( FrmAppHelper::is_admin_page( 'formidable-addons' ) ) {
self::$request_addon_url = 'https://connect.formidableforms.com/add-on-request/';
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 );
+ add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 );
add_filter( 'frm_show_footer_links', '__return_false' );
}
}
@@ -143,7 +143,7 @@ public static function list_addons() {
if ( isset( $addons['error'] ) ) {
$api = new FrmFormApi();
$errors = $api->get_error_from_response( $addons );
- $license_type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : '';
+ $license_type = $addons['error']['type'] ?? '';
unset( $addons['error'] );
}
@@ -415,7 +415,7 @@ public static function get_pro_download_url() {
$downloads = $api->get_api_info();
$pro = self::get_pro_from_addons( $downloads );
- return isset( $pro['url'] ) ? $pro['url'] : '';
+ return $pro['url'] ?? '';
}
/**
@@ -453,7 +453,7 @@ public static function get_pro_license() {
* @return array
*/
protected static function get_pro_from_addons( $addons ) {
- return isset( $addons['93790'] ) ? $addons['93790'] : array();
+ return $addons['93790'] ?? array();
}
/**
@@ -478,7 +478,7 @@ public static function is_license_expired() {
return false;
}
- $expires = isset( $version_info['error']['expires'] ) ? $version_info['error']['expires'] : 0;
+ $expires = $version_info['error']['expires'] ?? 0;
if ( empty( $expires ) || $expires > time() ) {
return false;
}
@@ -549,8 +549,8 @@ public static function check_update( $transient ) {
continue;
}
- $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
- $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
+ $wp_plugin = $wp_plugins[ $folder ] ?? array();
+ $wp_version = $wp_plugin['Version'] ?? '1.0';
$plugin->slug = explode( '/', $folder )[0];
if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
@@ -630,7 +630,7 @@ protected static function fill_update_addon_info( $installed_addons ) {
continue;
}
- $download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
+ $download_id = $plugin['id'] ?? 0;
if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
// if this addon is using its own license, get the update url
$addon_info = $api->get_api_info();
diff --git a/classes/controllers/FrmAntiSpamController.php b/classes/controllers/FrmAntiSpamController.php
index 25448ef9c4..b87d7dd76b 100644
--- a/classes/controllers/FrmAntiSpamController.php
+++ b/classes/controllers/FrmAntiSpamController.php
@@ -28,11 +28,11 @@ public static function is_spam( $values ) {
);
foreach ( $methods as $method ) {
- if ( ! is_callable( array( __CLASS__, $method ) ) ) {
+ if ( ! is_callable( array( self::class, $method ) ) ) {
continue;
}
- $is_spam = call_user_func( array( __CLASS__, $method ), $values );
+ $is_spam = call_user_func( array( self::class, $method ), $values );
if ( $is_spam ) {
return $is_spam;
}
diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php
index 923e494400..7b0d03f867 100644
--- a/classes/controllers/FrmAppController.php
+++ b/classes/controllers/FrmAppController.php
@@ -1031,7 +1031,7 @@ public static function create_rest_routes() {
$args = array(
'methods' => 'GET',
'callback' => 'FrmAppController::api_install',
- 'permission_callback' => __CLASS__ . '::can_update_db',
+ 'permission_callback' => self::class . '::can_update_db',
);
register_rest_route( 'frm-admin/v1', '/install', $args );
diff --git a/classes/controllers/FrmApplicationsController.php b/classes/controllers/FrmApplicationsController.php
index 7dca076e28..4f4904cd71 100644
--- a/classes/controllers/FrmApplicationsController.php
+++ b/classes/controllers/FrmApplicationsController.php
@@ -28,7 +28,7 @@ public static function menu() {
if ( ! isset( $slug ) ) {
$slug = 'formidable-applications';
- $callback = array( __CLASS__, 'landing_page' );
+ $callback = array( self::class, 'landing_page' );
}
add_submenu_page( 'formidable', 'Formidable | ' . $label, $label, $cap, $slug, $callback );
@@ -131,7 +131,7 @@ private static function get_prepared_template_data() {
FrmApplicationTemplate::init();
- return array_reduce( $applications, array( __CLASS__, 'reduce_template' ), array() );
+ return array_reduce( $applications, array( self::class, 'reduce_template' ), array() );
}
/**
diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php
index 467e35c60c..c5028e191d 100644
--- a/classes/controllers/FrmDashboardController.php
+++ b/classes/controllers/FrmDashboardController.php
@@ -21,7 +21,7 @@ class FrmDashboardController {
* @return void
*/
public static function load_admin_hooks() {
- add_action( 'admin_menu', __CLASS__ . '::menu', 9 );
+ add_action( 'admin_menu', self::class . '::menu', 9 );
}
/**
@@ -462,13 +462,13 @@ private static function get_youtube_embed_video( $entries_count ) {
return null;
}
if ( 0 === (int) $entries_count && false !== $welcome_video ) {
- return isset( $welcome_video['video-id'] ) ? $welcome_video['video-id'] : null;
+ return $welcome_video['video-id'] ?? null;
}
// We might receive the most recent video feed as the featured selection.
if ( isset( $featured_video[0] ) ) {
return $featured_video[0]['video-id'];
}
- return isset( $featured_video['video-id'] ) ? $featured_video['video-id'] : null;
+ return $featured_video['video-id'] ?? null;
}
/**
diff --git a/classes/controllers/FrmEntriesController.php b/classes/controllers/FrmEntriesController.php
index 55603eec64..3ffb39d250 100644
--- a/classes/controllers/FrmEntriesController.php
+++ b/classes/controllers/FrmEntriesController.php
@@ -100,7 +100,7 @@ private static function load_manage_entries_hooks() {
add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
add_filter( 'manage_' . $base . '_sortable_columns', 'FrmEntriesController::sortable_columns' );
} else {
- add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
+ add_filter( 'screen_options_show_screen', self::class . '::remove_screen_options', 10, 2 );
}
}
@@ -517,7 +517,7 @@ public static function display_list( $message = '', $errors = array() ) {
private static function get_delete_form_time( $form, &$errors ) {
if ( 'trash' === $form->status ) {
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
- $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? $form->options['trash_time'] : time() ) );
+ $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( $form->options['trash_time'] ?? time() ) );
/* translators: %1$s: Time string */
$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
diff --git a/classes/controllers/FrmFieldsController.php b/classes/controllers/FrmFieldsController.php
index 0f1c87f6c8..836006836d 100644
--- a/classes/controllers/FrmFieldsController.php
+++ b/classes/controllers/FrmFieldsController.php
@@ -184,7 +184,7 @@ public static function load_single_field( $field_object, $values, $form_id = 0 )
}
if ( ! isset( $field ) && is_object( $field_object ) ) {
- $field_object->parent_form_id = isset( $values['id'] ) ? $values['id'] : $field_object->form_id;
+ $field_object->parent_form_id = $values['id'] ?? $field_object->form_id;
$field = FrmFieldsHelper::setup_edit_vars( $field_object );
}
@@ -675,7 +675,7 @@ private static function add_html_placeholder( $field, array &$add_html, array &$
* @return string
*/
private static function prepare_placeholder( $field ) {
- $placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
+ $placeholder = $field['placeholder'] ?? '';
return $placeholder;
}
@@ -999,9 +999,9 @@ private static function add_pattern_attribute( $field, array &$add_html ) {
public static function check_value( $opt, $opt_key, $field ) {
if ( is_array( $opt ) ) {
if ( FrmField::is_option_true( $field, 'separate_value' ) ) {
- $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
+ $opt = $opt['value'] ?? $opt['label'] ?? reset( $opt );
} else {
- $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
+ $opt = $opt['label'] ?? reset( $opt );
}
}
@@ -1010,7 +1010,7 @@ public static function check_value( $opt, $opt_key, $field ) {
public static function check_label( $opt ) {
if ( is_array( $opt ) ) {
- $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
+ $opt = $opt['label'] ?? reset( $opt );
}
return $opt;
diff --git a/classes/controllers/FrmFormTemplatesController.php b/classes/controllers/FrmFormTemplatesController.php
index a4cdfdfc67..dfbd43cf6f 100644
--- a/classes/controllers/FrmFormTemplatesController.php
+++ b/classes/controllers/FrmFormTemplatesController.php
@@ -141,13 +141,13 @@ public static function load_admin_hooks() {
self::init_template_resources();
// Use the same priority as Applications so Form Templates appear directly under Applications.
- add_action( 'admin_menu', __CLASS__ . '::menu', 14 );
- add_action( 'admin_footer', __CLASS__ . '::render_modal' );
- add_filter( 'frm_form_nav_list', __CLASS__ . '::append_new_template_to_nav', 10, 2 );
+ add_action( 'admin_menu', self::class . '::menu', 14 );
+ add_action( 'admin_footer', self::class . '::render_modal' );
+ add_filter( 'frm_form_nav_list', self::class . '::append_new_template_to_nav', 10, 2 );
if ( self::is_templates_page() ) {
- add_action( 'admin_init', __CLASS__ . '::set_form_templates_data' );
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 );
+ add_action( 'admin_init', self::class . '::set_form_templates_data' );
+ add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 );
add_filter( 'frm_show_footer_links', '__return_false' );
}
}
@@ -168,7 +168,7 @@ public static function menu() {
$label,
self::REQUIRED_CAPABILITY,
self::PAGE_SLUG,
- array( __CLASS__, 'render' )
+ array( self::class, 'render' )
);
}
diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php
index 9002a13941..7cb80a720f 100644
--- a/classes/controllers/FrmFormsController.php
+++ b/classes/controllers/FrmFormsController.php
@@ -1411,7 +1411,7 @@ private static function get_settings_tabs( $values ) {
'advanced' => array(
'name' => __( 'General', 'formidable' ),
'title' => __( 'General Form Settings', 'formidable' ),
- 'function' => array( __CLASS__, 'advanced_settings' ),
+ 'function' => array( self::class, 'advanced_settings' ),
'icon' => 'frm_icon_font frm_settings_icon',
),
'email' => array(
@@ -1443,7 +1443,7 @@ private static function get_settings_tabs( $values ) {
),
'buttons' => array(
'name' => __( 'Buttons', 'formidable' ),
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'buttons_settings',
'icon' => 'frm_icon_font frm_button_icon',
),
@@ -1481,7 +1481,7 @@ private static function get_settings_tabs( $values ) {
),
'html' => array(
'name' => __( 'Customize HTML', 'formidable' ),
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'html_settings',
'icon' => 'frm_icon_font frm_code_icon',
),
@@ -3026,7 +3026,7 @@ private static function show_form_after_submit( $args ) {
$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
$frm_settings = FrmAppHelper::get_settings();
- $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
+ $submit = $form->options['submit_value'] ?? $frm_settings->submit_value;
global $frm_vars;
self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
@@ -3116,10 +3116,10 @@ private static function show_lone_success_message( $atts ) {
*/
private static function prepare_submit_message( $form, $entry_id, $args = array() ) {
$frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
- $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
+ $opt = $args['success_opt'] ?? 'success';
if ( $entry_id && is_numeric( $entry_id ) ) {
- $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
+ $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
$class = 'frm_message';
} else {
$message = $frm_settings->failed_msg;
diff --git a/classes/controllers/FrmOnboardingWizardController.php b/classes/controllers/FrmOnboardingWizardController.php
index 7dcf1b8d94..3b31b6ca26 100644
--- a/classes/controllers/FrmOnboardingWizardController.php
+++ b/classes/controllers/FrmOnboardingWizardController.php
@@ -123,10 +123,10 @@ class FrmOnboardingWizardController {
*/
public static function load_admin_hooks() {
self::set_page_url();
- add_action( 'admin_init', __CLASS__ . '::do_admin_redirects' );
+ add_action( 'admin_init', self::class . '::do_admin_redirects' );
if ( self::has_onboarding_been_skipped() ) {
- add_filter( 'option_frm_inbox', __CLASS__ . '::add_wizard_to_floating_links' );
+ add_filter( 'option_frm_inbox', self::class . '::add_wizard_to_floating_links' );
}
// Load page if admin page is Onboarding Wizard.
@@ -204,12 +204,12 @@ public static function maybe_load_page() {
$message = new FrmInbox();
$message->dismiss( 'onboarding_wizard' );
- add_action( 'admin_menu', __CLASS__ . '::menu', 99 );
- add_action( 'admin_init', __CLASS__ . '::assign_properties' );
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 );
- add_action( 'admin_head', __CLASS__ . '::remove_menu' );
+ add_action( 'admin_menu', self::class . '::menu', 99 );
+ add_action( 'admin_init', self::class . '::assign_properties' );
+ add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 );
+ add_action( 'admin_head', self::class . '::remove_menu' );
- add_filter( 'admin_body_class', __CLASS__ . '::add_admin_body_classes', 999 );
+ add_filter( 'admin_body_class', self::class . '::add_admin_body_classes', 999 );
add_filter( 'frm_show_footer_links', '__return_false' );
}
}
@@ -254,7 +254,7 @@ public static function menu() {
$label,
self::REQUIRED_CAPABILITY,
self::PAGE_SLUG,
- array( __CLASS__, 'render' )
+ array( self::class, 'render' )
);
}
diff --git a/classes/controllers/FrmSettingsController.php b/classes/controllers/FrmSettingsController.php
index b30160ac16..bb15071bb7 100644
--- a/classes/controllers/FrmSettingsController.php
+++ b/classes/controllers/FrmSettingsController.php
@@ -59,19 +59,19 @@ public static function display_form( $errors = array(), $message = '' ) {
private static function get_settings_tabs() {
$sections = array(
'general' => array(
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'general_settings',
'name' => __( 'General Settings', 'formidable' ),
'icon' => 'frm_icon_font frm_settings_icon',
),
'messages' => array(
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'message_settings',
'name' => __( 'Message Defaults', 'formidable' ),
'icon' => 'frm_icon_font frm_stamp_icon',
),
'permissions' => array(
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'permission_settings',
'name' => __( 'Permissions', 'formidable' ),
'icon' => 'frm_icon_font frm_lock_icon',
@@ -79,7 +79,7 @@ private static function get_settings_tabs() {
'payments' => array(
'name' => __( 'Payments', 'formidable' ),
'icon' => 'frm_icon_font frm_simple_cc_icon',
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'payments_settings',
),
'custom_css' => array(
@@ -95,7 +95,7 @@ private static function get_settings_tabs() {
'icon' => 'frm_icon_font frm_pallet_icon',
),
'captcha' => array(
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'captcha_settings',
'name' => __( 'Captcha/Spam', 'formidable' ),
'icon' => 'frm_icon_font frm_shield_check_icon',
@@ -153,7 +153,7 @@ private static function get_settings_tabs() {
$sections['misc'] = array(
'name' => __( 'Miscellaneous', 'formidable' ),
'icon' => 'frm_icon_font frm_shuffle_icon',
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'misc_settings',
);
@@ -203,7 +203,7 @@ private static function remove_payments_sections( &$sections ) {
}
}
- uksort( self::$removed_payments_sections, array( __CLASS__, 'payment_sections_sort_callback' ) );
+ uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) );
}
/**
@@ -240,7 +240,7 @@ public static function load_settings_tab() {
if ( isset( $section['class'] ) ) {
call_user_func( array( $section['class'], $section['function'] ) );
} else {
- call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
+ call_user_func( ( $section['function'] ?? $section ) );
}
wp_die();
}
diff --git a/classes/controllers/FrmUsageController.php b/classes/controllers/FrmUsageController.php
index e1f34f09a8..f138d7add5 100644
--- a/classes/controllers/FrmUsageController.php
+++ b/classes/controllers/FrmUsageController.php
@@ -40,10 +40,10 @@ public static function schedule_send() {
}
$tracking = array(
- 'day' => rand( 0, 6 ) * DAY_IN_SECONDS,
- 'hour' => rand( 0, 23 ) * HOUR_IN_SECONDS,
- 'minute' => rand( 0, 59 ) * MINUTE_IN_SECONDS,
- 'second' => rand( 0, 59 ),
+ 'day' => random_int( 0, 6 ) * DAY_IN_SECONDS,
+ 'hour' => random_int( 0, 23 ) * HOUR_IN_SECONDS,
+ 'minute' => random_int( 0, 59 ) * MINUTE_IN_SECONDS,
+ 'second' => random_int( 0, 59 ),
);
$offset = array_sum( $tracking );
diff --git a/classes/factories/FrmFieldFactory.php b/classes/factories/FrmFieldFactory.php
index 765469754c..ca3f722648 100644
--- a/classes/factories/FrmFieldFactory.php
+++ b/classes/factories/FrmFieldFactory.php
@@ -112,7 +112,7 @@ private static function get_field_type_class( $field_type ) {
FrmFieldGdprHelper::FIELD_TYPE => FrmFieldGdprHelper::get_gdpr_field_class( $field_type ),
);
- $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : '';
+ $class = $type_classes[ $field_type ] ?? '';
return apply_filters( 'frm_get_field_type_class', $class, $field_type );
}
diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php
index 761463645d..3bd6b38b89 100644
--- a/classes/helpers/FrmAppHelper.php
+++ b/classes/helpers/FrmAppHelper.php
@@ -56,7 +56,7 @@ public static function plugin_folder() {
* @return string
*/
public static function plugin_path() {
- return dirname( dirname( __DIR__ ) );
+ return dirname( __DIR__, 2 );
}
/**
@@ -128,7 +128,7 @@ public static function admin_upgrade_link( $args, $page = '' ) {
$anchor = '';
if ( is_array( $args ) ) {
- $medium = isset( $args['medium'] ) ? $args['medium'] : '';
+ $medium = $args['medium'] ?? '';
if ( isset( $args['content'] ) ) {
$content = $args['content'];
}
@@ -663,7 +663,7 @@ public static function get_param( $param, $default = '', $src = 'get', $sanitize
}
$p = trim( $p, ']' );
- $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
+ $value = $value[ $p ] ?? $default;
}
}
@@ -1024,7 +1024,7 @@ private static function allowed_html( $allowed ) {
$allowed_html = $html;
} elseif ( ! empty( $allowed ) ) {
foreach ( (array) $allowed as $a ) {
- $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
+ $allowed_html[ $a ] = $html[ $a ] ?? array();
}
}
@@ -1833,8 +1833,8 @@ public static function maybe_autocomplete_options( $args ) {
*/
private static function get_dropdown_value_and_label_from_option( $option, $key, $args ) {
if ( is_array( $option ) ) {
- $value = isset( $option[ $args['value_key'] ] ) ? $option[ $args['value_key'] ] : '';
- $label = isset( $option[ $args['label_key'] ] ) ? $option[ $args['label_key'] ] : '';
+ $value = $option[ $args['value_key'] ] ?? '';
+ $label = $option[ $args['label_key'] ] ?? '';
} else {
$value = $key;
$label = $option;
@@ -2536,11 +2536,11 @@ private static function maybe_clear_long_key( $key, $column ) {
* @return string
*/
public static function generate_new_key( $num_chars ) {
- $max_slug_value = pow( 36, $num_chars );
+ $max_slug_value = 36 ** $num_chars;
// We want to have at least 2 characters in the slug.
$min_slug_value = 37;
- return base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
+ return base_convert( random_int( $min_slug_value, $max_slug_value ), 10, 36 );
}
/**
@@ -2594,7 +2594,7 @@ public static function setup_edit_vars( $record, $table, $fields = '', $default
);
foreach ( array( 'name', 'description' ) as $var ) {
- $default_val = isset( $record->{$var} ) ? $record->{$var} : '';
+ $default_val = $record->{$var} ?? '';
$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
unset( $var, $default_val );
}
@@ -2621,7 +2621,7 @@ private static function prepare_field_arrays( $fields, $record, array &$values,
// Don't prep default values on the form settings page.
$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
}
- $args['parent_form_id'] = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
+ $args['parent_form_id'] = $args['parent_form_id'] ?? $field->form_id;
self::fill_field_defaults( $field, $record, $values, $args );
}
}
@@ -2651,7 +2651,7 @@ private static function fill_field_defaults( $field, $record, array &$values, $a
$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
}//end if
- $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
+ $field_type = $post_values['field_options'][ 'type_' . $field->id ] ?? $field->type;
if ( isset( $post_values['item_meta'][ $field->id ] ) ) {
$new_value = $post_values['item_meta'][ $field->id ];
self::unserialize_or_decode( $new_value );
@@ -2755,7 +2755,7 @@ private static function fill_form_defaults( $post_values, array &$values ) {
foreach ( array( 'before', 'after', 'submit' ) as $h ) {
if ( ! isset( $values[ $h . '_html' ] ) ) {
- $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
+ $values[ $h . '_html' ] = ( $post_values['options'][ $h . '_html' ] ?? FrmFormsHelper::get_default_html( $h ) );
}
unset( $h );
}
diff --git a/classes/helpers/FrmCSVExportHelper.php b/classes/helpers/FrmCSVExportHelper.php
index df747a5e78..c07f9796b5 100644
--- a/classes/helpers/FrmCSVExportHelper.php
+++ b/classes/helpers/FrmCSVExportHelper.php
@@ -591,7 +591,7 @@ private static function get_field( $field_id ) {
private static function add_field_values_to_csv( &$row ) {
foreach ( self::$fields as $col ) {
- $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
+ $field_value = self::$entry->metas[ $col->id ] ?? false;
FrmFieldsHelper::prepare_field_value( $field_value, $col->type );
self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) );
diff --git a/classes/helpers/FrmEntriesHelper.php b/classes/helpers/FrmEntriesHelper.php
index c51172c5af..8a05031218 100644
--- a/classes/helpers/FrmEntriesHelper.php
+++ b/classes/helpers/FrmEntriesHelper.php
@@ -43,9 +43,9 @@ public static function setup_new_vars( $fields, $form = '', $reset = false, $arg
$field_array = FrmAppHelper::start_field_array( $field );
$field_array['value'] = $new_value;
$field_array['type'] = apply_filters( 'frm_field_type', $field->type, $field, $new_value );
- $field_array['parent_form_id'] = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
+ $field_array['parent_form_id'] = $args['parent_form_id'] ?? $field->form_id;
$field_array['reset_value'] = $reset;
- $field_array['in_embed_form'] = isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0';
+ $field_array['in_embed_form'] = $args['in_embed_form'] ?? '0';
$field_array['original_default'] = $original_default;
FrmFieldsHelper::prepare_new_front_field( $field_array, $field, $args );
@@ -195,7 +195,7 @@ public static function replace_default_message( $message, $atts ) {
* @return string
*/
public static function prepare_display_value( $entry, $field, $atts ) {
- $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
+ $field_value = $entry->metas[ $field->id ] ?? false;
if ( FrmAppHelper::pro_is_installed() ) {
$empty = empty( $field_value );
@@ -223,7 +223,7 @@ public static function prepare_display_value( $entry, $field, $atts ) {
$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true );
} else {
// Get all values for this field.
- $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
+ $child_values = $entry->metas[ $atts['embedded_field_id'] ] ?? false;
if ( $child_values ) {
$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -308,7 +308,7 @@ public static function display_value( $value, $field, $atts = array() ) {
if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] === 'tag' ) ) {
$atts['pre_truncate'] = $atts['truncate'];
$atts['truncate'] = true;
- $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
+ $atts['exclude_cat'] = $field->field_options['exclude_cat'] ?? 0;
$value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
$atts['truncate'] = $atts['pre_truncate'];
@@ -639,7 +639,7 @@ public static function get_browser( $u_agent ) {
* @since 3.0
*/
public static function actions_dropdown( $atts ) {
- $id = isset( $atts['id'] ) ? $atts['id'] : FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
+ $id = $atts['id'] ?? FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
$links = self::get_action_links( $id, $atts['entry'] );
foreach ( $links as $link ) {
diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php
index 46fe3e205a..ccec14eb64 100644
--- a/classes/helpers/FrmFieldsHelper.php
+++ b/classes/helpers/FrmFieldsHelper.php
@@ -71,7 +71,7 @@ public static function field_object_to_array( $field ) {
self::fill_field_array( $field, $values );
- $values['custom_html'] = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : self::get_default_html( $field->type );
+ $values['custom_html'] = $field->field_options['custom_html'] ?? self::get_default_html( $field->type );
return $values;
}
@@ -121,7 +121,7 @@ private static function prepare_front_field( &$field_array, $field, $args ) {
self::fill_cleared_strings( $field, $field_array );
// Track the original field's type
- $field_array['original_type'] = isset( $field->field_options['original_type'] ) ? $field->field_options['original_type'] : $field->type;
+ $field_array['original_type'] = $field->field_options['original_type'] ?? $field->type;
self::prepare_field_options_for_display( $field_array, $field, $args );
@@ -172,7 +172,7 @@ private static function fill_default_field_opts( $field, array &$values ) {
}
foreach ( $defaults as $opt => $default ) {
- $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
+ $values[ $opt ] = $field->field_options[ $opt ] ?? $default;
if ( $check_post ) {
self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
@@ -533,7 +533,7 @@ public static function show_fields( $fields, $errors, $form, $form_action ) {
* @param array|string $value
*/
public static function run_wpautop( $atts, &$value ) {
- $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true;
+ $autop = $atts['wpautop'] ?? true;
if ( apply_filters( 'frm_use_wpautop', $autop ) ) {
if ( is_array( $value ) ) {
$value = implode( "\n", $value );
@@ -599,7 +599,7 @@ public static function show_single_option( $field ) {
}
$base_name = 'default_value_' . $field['id'];
- $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
+ $html_id = $field['html_id'] ?? self::get_html_id( $field );
$default_type = self::get_default_value_type( $field );
$options_count = count( $field['options'] );
@@ -643,7 +643,7 @@ private static function hidden_field_option( $field ) {
$opt = __( 'New Option', 'formidable' );
$checked = false;
$field_name = 'default_value_' . $field['id'];
- $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
+ $html_id = $field['html_id'] ?? self::get_html_id( $field );
$default_type = self::get_default_value_type( $field );
$field_name .= ( $default_type === 'checkbox' ? '[' . $opt_key . ']' : '' );
@@ -1098,7 +1098,7 @@ private static function get_field_shortcode_value( $atts ) {
$replace_with = FrmEntryMeta::get_meta_value( $atts['entry'], $field->id );
$string_value = $replace_with;
if ( is_array( $replace_with ) ) {
- $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
+ $sep = $atts['sep'] ?? ', ';
$string_value = FrmAppHelper::safe_implode( $sep, $replace_with );
}
@@ -1174,7 +1174,7 @@ public static function process_get_shortcode( $atts, $return_array = false ) {
$atts['prev_val'] = '';
}
- $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
+ $new_value = $atts['default'] ?? $atts['prev_val'];
}
if ( is_array( $new_value ) && ! $return_array ) {
@@ -1200,7 +1200,7 @@ public static function get_display_value( $value, $field, $atts = array() ) {
public static function get_unfiltered_display_value( $atts ) {
$value = $atts['value'];
$field = $atts['field'];
- $atts = isset( $atts['atts'] ) ? $atts['atts'] : $atts;
+ $atts = $atts['atts'] ?? $atts;
if ( is_array( $field ) ) {
$field = $field['id'];
@@ -1236,7 +1236,7 @@ public static function get_user_display_name( $user_id, $user_info = 'display_na
} elseif ( $user_info === 'author_link' ) {
$info = get_author_posts_url( $user_id );
} else {
- $info = isset( $user->$user_info ) ? $user->$user_info : '';
+ $info = $user->$user_info ?? '';
}
if ( 'display_name' === $user_info && empty( $info ) && ! $args['blank'] ) {
@@ -1535,7 +1535,7 @@ public static function include_other_input( $args ) {
// Set up HTML ID for Other field
$other_id = self::get_other_field_html_id( $args['field']['type'], $args['html_id'], $args['opt_key'] );
- $label = isset( $args['opt_label'] ) ? $args['opt_label'] : $args['field']['name'];
+ $label = $args['opt_label'] ?? $args['field']['name'];
echo '
diff --git a/classes/views/frm-forms/form.php b/classes/views/frm-forms/form.php
index 8c85075656..ad26b4a3f7 100644
--- a/classes/views/frm-forms/form.php
+++ b/classes/views/frm-forms/form.php
@@ -68,7 +68,7 @@
diff --git a/classes/views/frm-forms/mb_html_tab.php b/classes/views/frm-forms/mb_html_tab.php
index 3e4b946b30..f957758b8f 100644
--- a/classes/views/frm-forms/mb_html_tab.php
+++ b/classes/views/frm-forms/mb_html_tab.php
@@ -14,7 +14,7 @@
'code' => $skey,
'label' => $code['label'],
'class' => $code['class'],
- 'title' => isset( $code['title'] ) ? $code['title'] : '',
+ 'title' => $code['title'] ?? '',
)
);
}
diff --git a/classes/views/frm-forms/settings.php b/classes/views/frm-forms/settings.php
index 99bab9e748..784f8805dc 100644
--- a/classes/views/frm-forms/settings.php
+++ b/classes/views/frm-forms/settings.php
@@ -47,7 +47,7 @@
if ( isset( $section['class'] ) ) {
call_user_func( array( $section['class'], $section['function'] ), $values );
} elseif ( ! isset( $section['data'] ) ) {
- call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ), $values );
+ call_user_func( ( $section['function'] ?? $section ), $values );
}
?>
diff --git a/classes/views/frm-settings/payments.php b/classes/views/frm-settings/payments.php
index 1b81315ced..c53038c218 100644
--- a/classes/views/frm-settings/payments.php
+++ b/classes/views/frm-settings/payments.php
@@ -13,7 +13,7 @@
foreach ( $payment_sections as $key => $section ) {
$is_active = $tab === $key;
- $name = isset( $section['name'] ) ? $section['name'] : ucfirst( $key );
+ $name = $section['name'] ?? ucfirst( $key );
$input_params = array(
'id' => "frm_toggle_{$key}_settings",
'type' => 'radio',
@@ -74,7 +74,7 @@ function ( $section ) {
if ( isset( $section['class'] ) ) {
call_user_func( array( $section['class'], $section['function'] ) );
} else {
- call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
+ call_user_func( ( $section['function'] ?? $section ) );
}
?>
diff --git a/classes/views/shared/mb_adv_info.php b/classes/views/shared/mb_adv_info.php
index 56af86f3fe..f51d815eda 100644
--- a/classes/views/shared/mb_adv_info.php
+++ b/classes/views/shared/mb_adv_info.php
@@ -252,7 +252,7 @@
array(
'code' => $include_x . $code,
'label' => $code_label['label'],
- 'title' => isset( $code_label['title'] ) ? $code_label['title'] : '',
+ 'title' => $code_label['title'] ?? '',
'class' => 'frm-advanced-list',
)
);
diff --git a/classes/views/shared/toggle.php b/classes/views/shared/toggle.php
index bd4ba63ca6..cc41eddcc8 100644
--- a/classes/views/shared/toggle.php
+++ b/classes/views/shared/toggle.php
@@ -14,15 +14,15 @@
}
?>
diff --git a/classes/views/summary-emails/stats-plain.php b/classes/views/summary-emails/stats-plain.php
index ae78763fd0..a216874145 100644
--- a/classes/views/summary-emails/stats-plain.php
+++ b/classes/views/summary-emails/stats-plain.php
@@ -25,7 +25,7 @@
echo "\r\n\r\n";
foreach ( $args['stats'] as $stat ) {
- FrmEmailSummaryHelper::plain_text_echo( $stat['label'] . ': ' . ( isset( $stat['display'] ) ? $stat['display'] : intval( $stat['count'] ) ) . "\r\n" );
+ FrmEmailSummaryHelper::plain_text_echo( $stat['label'] . ': ' . ( $stat['display'] ?? intval( $stat['count'] ) ) . "\r\n" );
}
echo "\r\n";
diff --git a/classes/views/xml/import_form.php b/classes/views/xml/import_form.php
index 39caa6eb70..2f44e952d0 100644
--- a/classes/views/xml/import_form.php
+++ b/classes/views/xml/import_form.php
@@ -80,7 +80,7 @@
@@ -187,7 +187,7 @@
options['custom_style'] ) ? $form->options['custom_style'] : 1;
+ $style = $form->options['custom_style'] ?? 1;
if ( empty( $style ) ) {
echo '0';
} else {
diff --git a/classes/widgets/FrmShowForm.php b/classes/widgets/FrmShowForm.php
index 3d8691e0ec..873f9dd24f 100644
--- a/classes/widgets/FrmShowForm.php
+++ b/classes/widgets/FrmShowForm.php
@@ -21,9 +21,9 @@ public function widget( $args, $instance ) {
}
$form_atts = array(
- 'id' => isset( $instance['form'] ) ? $instance['form'] : 0,
+ 'id' => $instance['form'] ?? 0,
'title' => false,
- 'description' => isset( $instance['description'] ) ? $instance['description'] : false,
+ 'description' => $instance['description'] ?? false,
);
echo FrmFormsController::get_form_shortcode( $form_atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
diff --git a/phpstan.neon b/phpstan.neon
index 0189c81d3d..3610e53fe2 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -45,6 +45,9 @@ parameters:
- '#in empty\(\) is not falsy.#'
- '#always exists and is not falsy.#'
- '#has no type specified.#'
+ - '#of function random_int expects lower number#'
+ - '#get_gateway_for_action\(\) never returns array so it can be removed from the return type#'
+ - "#on left side of ??#"
-
message: '#has an unused parameter#'
paths:
diff --git a/rector.php b/rector.php
index ed24504b66..16bd543168 100644
--- a/rector.php
+++ b/rector.php
@@ -1,8 +1,6 @@
withPhpSets(
+ // PHP 8.3
+ false,
+ // PHP 8.2
+ false,
+ // PHP 8.1
+ false,
+ // PHP 8.0
+ false,
+ // PHP 7.4
+ false,
+ // PHP 7.3
+ false,
+ // PHP 7.2
+ false,
+ // PHP 7.1
+ false,
+ // PHP 7.0
+ true
+ )
->withSkip(
array(
- FlipNegatedTernaryInstanceofRector::class,
SwitchNegatedTernaryRector::class,
CompactToVariablesRector::class,
IssetOnPropertyObjectToPropertyExistsRector::class,
@@ -88,7 +107,6 @@
RemoveUnreachableStatementRector::class,
SimplifyEmptyArrayCheckRector::class,
CompleteDynamicPropertiesRector::class,
- TypedPropertyFromStrictConstructorRector::class,
// TODO: Try this for some files and not others.
RemoveUnusedPrivateMethodRector::class,
ShortenElseIfRector::class,
@@ -106,5 +124,7 @@
RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
RemoveUnusedConstructorParamRector::class,
UnnecessaryTernaryExpressionRector::class,
+ LongArrayToShortArrayRector::class,
+ TernaryToElvisRector::class,
)
);
diff --git a/stripe/controllers/FrmStrpLiteActionsController.php b/stripe/controllers/FrmStrpLiteActionsController.php
index 2d10480818..25f1c31510 100644
--- a/stripe/controllers/FrmStrpLiteActionsController.php
+++ b/stripe/controllers/FrmStrpLiteActionsController.php
@@ -616,7 +616,7 @@ public static function remove_cc_validation( $errors, $field, $values ) {
return $errors;
}
- $field_id = isset( $field->temp_id ) ? $field->temp_id : $field->id;
+ $field_id = $field->temp_id ?? $field->id;
if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) {
unset( $errors[ 'field' . $field_id . '-cc' ] );
diff --git a/stripe/controllers/FrmStrpLiteEventsController.php b/stripe/controllers/FrmStrpLiteEventsController.php
index c2993f5462..08e0b7a89b 100644
--- a/stripe/controllers/FrmStrpLiteEventsController.php
+++ b/stripe/controllers/FrmStrpLiteEventsController.php
@@ -520,7 +520,7 @@ private function track_handled_event( $event_id ) {
*/
private function handle_event() {
$this->invoice = $this->event->data->object;
- $this->charge = isset( $this->invoice->charge ) ? $this->invoice->charge : false;
+ $this->charge = $this->invoice->charge ?? false;
if ( ! $this->charge && $this->invoice->object === 'payment_intent' ) {
$this->charge = $this->invoice->id;
}
diff --git a/stripe/controllers/FrmStrpLiteSettingsController.php b/stripe/controllers/FrmStrpLiteSettingsController.php
index bf69704ee3..fe234eb8dc 100644
--- a/stripe/controllers/FrmStrpLiteSettingsController.php
+++ b/stripe/controllers/FrmStrpLiteSettingsController.php
@@ -13,7 +13,7 @@ class FrmStrpLiteSettingsController {
*/
public static function add_settings_section( $sections ) {
$sections['stripe'] = array(
- 'class' => __CLASS__,
+ 'class' => self::class,
'function' => 'route',
'icon' => 'frm_icon_font frm_stripe_icon',
);
diff --git a/stripe/controllers/FrmTransLiteActionsController.php b/stripe/controllers/FrmTransLiteActionsController.php
index fd4eef6f4a..88a103e4d0 100755
--- a/stripe/controllers/FrmTransLiteActionsController.php
+++ b/stripe/controllers/FrmTransLiteActionsController.php
@@ -110,10 +110,7 @@ public static function trigger_action( $action, $entry, $form ) {
* @return array|string
*/
private static function get_gateway_for_action( $action ) {
- if ( isset( $action->post_content['gateway'] ) ) {
- return $action->post_content['gateway'];
- }
- return 'stripe';
+ return $action->post_content['gateway'] ?? 'stripe';
}
/**
@@ -126,7 +123,7 @@ private static function show_failed_message( $args ) {
global $frm_vars;
$frm_vars['frm_trans'] = array(
'pay_entry' => $args['entry'],
- 'error' => isset( $args['response']['error'] ) ? $args['response']['error'] : '',
+ 'error' => $args['response']['error'] ?? '',
);
add_filter( 'frm_success_filter', 'FrmTransLiteActionsController::force_message_after_create' );
@@ -151,7 +148,7 @@ public static function include_form_with_success( $form ) {
*/
public static function replace_success_message() {
global $frm_vars;
- $message = isset( $frm_vars['frm_trans']['error'] ) ? $frm_vars['frm_trans']['error'] : '';
+ $message = $frm_vars['frm_trans']['error'] ?? '';
if ( empty( $message ) ) {
$message = __( 'There was an error processing your payment.', 'formidable' );
}
@@ -390,7 +387,7 @@ public static function prepare_settings_for_js( $form_id ) {
'fields' => self::get_fields_for_price( $payment_action ),
'one' => $payment_action->post_content['type'],
'email' => $payment_action->post_content['email'],
- 'layout' => isset( $payment_action->post_content['layout'] ) ? $payment_action->post_content['layout'] : '',
+ 'layout' => $payment_action->post_content['layout'] ?? '',
);
/**
@@ -415,7 +412,7 @@ public static function prepare_settings_for_js( $form_id ) {
private static function get_fields_for_price( $action ) {
$amount = $action->post_content['amount'];
$shortcodes = FrmFieldsHelper::get_shortcodes( $amount, $action->menu_order );
- return isset( $shortcodes[2] ) ? $shortcodes[2] : -1;
+ return $shortcodes[2] ?? -1;
}
/**
@@ -468,7 +465,7 @@ public static function hide_gateway_field_on_front_end( $values, $field ) {
*/
public static function fill_entry_from_previous( $values, $field ) {
global $frm_vars;
- $previous_entry = isset( $frm_vars['frm_trans']['pay_entry'] ) ? $frm_vars['frm_trans']['pay_entry'] : false;
+ $previous_entry = $frm_vars['frm_trans']['pay_entry'] ?? false;
if ( empty( $previous_entry ) || $previous_entry->form_id != $field->form_id ) {
return $values;
}
diff --git a/stripe/controllers/FrmTransLiteEntriesController.php b/stripe/controllers/FrmTransLiteEntriesController.php
index 848baba1ca..589c9efa92 100755
--- a/stripe/controllers/FrmTransLiteEntriesController.php
+++ b/stripe/controllers/FrmTransLiteEntriesController.php
@@ -18,7 +18,7 @@ public static function sidebar_list( $entry ) {
// This line removes PayPal actions from the entries sidebar.
remove_action( 'frm_show_entry_sidebar', 'FrmPaymentsController::sidebar_list' );
- add_action( 'frm_entry_shared_sidebar_middle', __CLASS__ . '::show_sidebar_list' );
+ add_action( 'frm_entry_shared_sidebar_middle', self::class . '::show_sidebar_list' );
}
/**
diff --git a/stripe/controllers/FrmTransLiteListsController.php b/stripe/controllers/FrmTransLiteListsController.php
index d32a4b74e5..a8ecc5bc97 100755
--- a/stripe/controllers/FrmTransLiteListsController.php
+++ b/stripe/controllers/FrmTransLiteListsController.php
@@ -16,8 +16,8 @@ public static function add_list_hooks() {
$unread_count = FrmEntriesHelper::get_visible_unread_inbox_count();
$hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns';
- add_filter( $hook_name, __CLASS__ . '::payment_columns' );
- add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 );
+ add_filter( $hook_name, self::class . '::payment_columns' );
+ add_filter( 'screen_options_show_screen', self::class . '::remove_screen_options', 10, 2 );
}
/**
diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php
index 7988285b39..92dc7dc5cd 100644
--- a/stripe/helpers/FrmStrpLiteConnectHelper.php
+++ b/stripe/helpers/FrmStrpLiteConnectHelper.php
@@ -175,7 +175,7 @@ private static function post_to_connect_server( $action, $additional_body = arra
return 'Response from server was not successful';
}
- return isset( $body->data ) ? $body->data : array();
+ return $body->data ?? array();
}
/**
diff --git a/stripe/helpers/FrmStrpLiteSubscriptionHelper.php b/stripe/helpers/FrmStrpLiteSubscriptionHelper.php
index 2e4214a855..eb1ad1f35a 100644
--- a/stripe/helpers/FrmStrpLiteSubscriptionHelper.php
+++ b/stripe/helpers/FrmStrpLiteSubscriptionHelper.php
@@ -47,7 +47,7 @@ public static function create_new_subscription( $atts ) {
'paysys' => 'stripe',
'item_id' => $atts['entry']->id,
'action_id' => $atts['action']->ID,
- 'sub_id' => isset( $atts['charge']->sub_id ) ? $atts['charge']->sub_id : '',
+ 'sub_id' => $atts['charge']->sub_id ?? '',
'interval_count' => $atts['action']->post_content['interval_count'],
'time_interval' => $atts['action']->post_content['interval'],
'status' => 'active',
diff --git a/stripe/helpers/FrmStrpLiteUrlParamHelper.php b/stripe/helpers/FrmStrpLiteUrlParamHelper.php
index d3b12cff0d..7492341e6f 100644
--- a/stripe/helpers/FrmStrpLiteUrlParamHelper.php
+++ b/stripe/helpers/FrmStrpLiteUrlParamHelper.php
@@ -29,7 +29,7 @@ public static function get_details_for_form( $form_id ) {
if ( ! isset( self::$details_by_form_id[ $form_id ] ) ) {
self::set_details_for_form( (int) $form_id );
}
- return isset( self::$details_by_form_id[ $form_id ] ) ? self::$details_by_form_id[ $form_id ] : false;
+ return self::$details_by_form_id[ $form_id ] ?? false;
}
/**
diff --git a/stripe/helpers/FrmTransLiteAppHelper.php b/stripe/helpers/FrmTransLiteAppHelper.php
index e75b4ae7b1..f42e4e8127 100755
--- a/stripe/helpers/FrmTransLiteAppHelper.php
+++ b/stripe/helpers/FrmTransLiteAppHelper.php
@@ -66,7 +66,7 @@ public static function payments_table_exists() {
*/
public static function show_status( $status ) {
$statuses = array_merge( self::get_payment_statuses(), self::get_subscription_statuses() );
- return isset( $statuses[ $status ] ) ? $statuses[ $status ] : $status;
+ return $statuses[ $status ] ?? $status;
}
/**
@@ -127,7 +127,7 @@ public static function add_note_to_payment( &$payment_values, $message = '' ) {
$payment_values['status']
);
}
- $payment_values['meta_value'] = isset( $payment_values['meta_value'] ) ? $payment_values['meta_value'] : array();
+ $payment_values['meta_value'] = $payment_values['meta_value'] ?? array();
$payment_values['meta_value'] = self::add_meta_to_payment( $payment_values['meta_value'], $message );
}
@@ -152,7 +152,7 @@ public static function add_meta_to_payment( $meta_value, $note ) {
*/
public static function get_action_setting( $option, $atts ) {
$settings = self::get_action_settings( $atts );
- $value = isset( $settings[ $option ] ) ? $settings[ $option ] : '';
+ $value = $settings[ $option ] ?? '';
return $value;
}
@@ -403,7 +403,7 @@ public static function show_in_table( $value, $label ) {
* @return void
*/
public static function echo_confirmation_link( $link ) {
- $filter = __CLASS__ . '::allow_deleteconfirm_data_attribute';
+ $filter = self::class . '::allow_deleteconfirm_data_attribute';
add_filter( 'frm_striphtml_allowed_tags', $filter );
FrmAppHelper::kses_echo( $link, array( 'a' ) );
remove_filter( 'frm_striphtml_allowed_tags', $filter );
diff --git a/stripe/models/FrmStrpLiteAuth.php b/stripe/models/FrmStrpLiteAuth.php
index b570f8207f..a13ff23fd2 100644
--- a/stripe/models/FrmStrpLiteAuth.php
+++ b/stripe/models/FrmStrpLiteAuth.php
@@ -276,7 +276,7 @@ public static function update_intent_ajax() {
self::format_form_data( $form );
$form_id = absint( $form['form_id'] );
- $intents = isset( $form[ 'frmintent' . $form_id ] ) ? $form[ 'frmintent' . $form_id ] : array();
+ $intents = $form[ 'frmintent' . $form_id ] ?? array();
if ( empty( $intents ) ) {
wp_die();
|