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
20 changes: 10 additions & 10 deletions classes/controllers/FrmAddonsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}
Expand Down Expand Up @@ -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'] );
}

Expand Down Expand Up @@ -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'] ?? '';
}

/**
Expand Down Expand Up @@ -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();
}

/**
Expand All @@ -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;
}
Expand Down Expand Up @@ -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, '<' ) ) {
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions classes/controllers/FrmAntiSpamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions classes/controllers/FrmApplicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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() );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/controllers/FrmEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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 );
Expand Down
10 changes: 5 additions & 5 deletions classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 );
}
}

Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions classes/controllers/FrmFormTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}
Expand All @@ -168,7 +168,7 @@ public static function menu() {
$label,
self::REQUIRED_CAPABILITY,
self::PAGE_SLUG,
array( __CLASS__, 'render' )
array( self::class, 'render' )
);
}

Expand Down
12 changes: 6 additions & 6 deletions classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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',
),
Expand Down Expand Up @@ -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',
),
Expand Down Expand Up @@ -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'] );
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions classes/controllers/FrmOnboardingWizardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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' );
}
}
Expand Down Expand Up @@ -254,7 +254,7 @@ public static function menu() {
$label,
self::REQUIRED_CAPABILITY,
self::PAGE_SLUG,
array( __CLASS__, 'render' )
array( self::class, 'render' )
);
}

Expand Down
16 changes: 8 additions & 8 deletions classes/controllers/FrmSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,27 @@ 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',
),
'payments' => array(
'name' => __( 'Payments', 'formidable' ),
'icon' => 'frm_icon_font frm_simple_cc_icon',
'class' => __CLASS__,
'class' => self::class,
'function' => 'payments_settings',
),
'custom_css' => array(
Expand All @@ -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',
Expand Down Expand Up @@ -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',
);

Expand Down Expand Up @@ -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' ) );
}

/**
Expand Down Expand Up @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions classes/controllers/FrmUsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Loading