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
12 changes: 2 additions & 10 deletions classes/controllers/FrmAddonsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,7 @@ protected static function uninstall_plugin( $plugin ) {
self::deactivate_plugin( $plugin, true );
$result = delete_plugins( array( $plugin ) );

if ( is_wp_error( $result ) ) {
return $result;
}

return true;
return is_wp_error( $result ) ? $result : true;
}

/**
Expand Down Expand Up @@ -1267,11 +1263,7 @@ private static function get_activating_page() {
return 'settings';
}

if ( str_contains( $referer, 'frm_action=edit' ) ) {
return 'form_builder';
}

return '';
return str_contains( $referer, 'frm_action=edit' ) ? 'form_builder' : '';
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,7 @@ private static function get_dashboard_options( $option_name = null ) {
return array();
}

if ( null !== $option_name ) {
return $options[ $option_name ];
}

return $options;
return null !== $option_name ? $options[ $option_name ] : $options;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/controllers/FrmDeactivationFeedbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ private static function feedback_is_expired() {

$expired_date = strtotime( $feedback_expired );

if ( ! $expired_date ) {
return true;
}

return $expired_date < time();
return $expired_date ? $expired_date < time() : true;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,7 @@ public static function pull_custom_error_body_from_custom_html( $form, $field, $
'<div class="frm_error" role="alert">[error]</div>',
);

if ( in_array( $error_body, $default_html, true ) ) {
return false;
}

return $error_body;
return in_array( $error_body, $default_html, true ) ? false : $error_body;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions classes/controllers/FrmFormActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,7 @@ public static function limit_by_type( $where ) {
* @return bool|null
*/
public static function prevent_wpml_translations( $null, $post_type ) {
if ( self::$action_post_type === $post_type ) {
return false;
}
return $null;
return self::$action_post_type === $post_type ? false : $null;
}
}

Expand Down
7 changes: 1 addition & 6 deletions classes/controllers/FrmXMLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ private static function validate_xml_url( $url ) {
*/
private static function get_posted_form() {
$form = FrmAppHelper::get_param( 'form', '', 'post', 'wp_unslash' );

if ( ! $form ) {
return $form;
}

return json_decode( $form, true );
return $form ? json_decode( $form, true ) : $form;
}

/**
Expand Down
18 changes: 3 additions & 15 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,7 @@ private static function pull_medium_from_link( $link ) {

$query_args = wp_parse_args( $parsed['query'] );

if ( empty( $query_args['utm_medium'] ) ) {
return '';
}

return $query_args['utm_medium'];
return empty( $query_args['utm_medium'] ) ? '' : $query_args['utm_medium'];
}

/**
Expand Down Expand Up @@ -2282,11 +2278,7 @@ public static function current_user_can( $role ) {
$role = 'administrator';
}

if ( ! is_user_logged_in() ) {
return false;
}

return current_user_can( $role );
return is_user_logged_in() ? current_user_can( $role ) : false;
}

/**
Expand Down Expand Up @@ -5004,11 +4996,7 @@ public static function is_valid_utf8( $string ) {
}

// As of WP 6.9, seems_utf8 is deprecated.
if ( function_exists( 'seems_utf8' ) ) {
return seems_utf8( $string );
}

return false;
return function_exists( 'seems_utf8' ) ? seems_utf8( $string ) : false;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/helpers/FrmCSVExportHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,7 @@ private static function is_the_child_of_a_repeater( $field ) {
$section_id = $field->field_options['in_section'];
$section = FrmField::getOne( $section_id );

if ( ! $section ) {
return false;
}

return FrmField::is_repeating_field( $section );
return $section && FrmField::is_repeating_field( $section );
}

/**
Expand Down
12 changes: 2 additions & 10 deletions classes/helpers/FrmEmailSummaryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ private static function get_renewal_date() {
* @return DateTime|false
*/
private static function get_date_obj( $date ) {
if ( $date instanceof DateTime ) {
return $date;
}

return date_create( $date );
return $date instanceof DateTime ? $date : date_create( $date );
}

/**
Expand All @@ -236,11 +232,7 @@ private static function get_date_diff( $date1, $date2 ) {

$date2 = self::get_date_obj( $date2 );

if ( ! $date2 ) {
return false;
}

return date_diff( $date1, $date2 )->days;
return $date2 ? date_diff( $date1, $date2 )->days : false;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions classes/helpers/FrmFieldGdprHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public static function add_gdpr_field( $fields ) {
* @return string
*/
public static function get_gdpr_field_class( $field_type = '' ) {
if ( self::FIELD_TYPE === $field_type ) {
return self::FIELD_CLASS;
}
return '';
return self::FIELD_TYPE === $field_type ? self::FIELD_CLASS : '';
}
}
6 changes: 1 addition & 5 deletions classes/helpers/FrmFormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,7 @@ public static function get_form_style_class( $form = false ) {
$class = ' with_frm_style';

if ( ! $style ) {
if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
return $class;
}

return null;
return FrmAppHelper::is_admin_page( 'formidable-entries' ) ? $class : null;
}

// If submit button needs to be inline or centered.
Expand Down
6 changes: 1 addition & 5 deletions classes/helpers/FrmStylesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,6 @@ public static function get_bottom_value( $value ) {

$parts = explode( ' ', $value );

if ( count( $parts ) < 3 ) {
return $parts[0];
}

return $parts[2];
return count( $parts ) < 3 ? $parts[0] : $parts[2];
}
}
5 changes: 1 addition & 4 deletions classes/models/FrmCreateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ public function combine_files( $file_names ) {
* @return string
*/
public function get_file_contents() {
if ( $this->has_permission ) {
return $this->get_contents();
}
return '';
return $this->has_permission ? $this->get_contents() : '';
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/models/FrmInbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ private function within_valid_timeframe( $message ) {
* @return bool
*/
private function has_started( $message ) {
if ( empty( $message['starts'] ) ) {
return true;
}

return $message['starts'] <= time();
return empty( $message['starts'] ) ? true : $message['starts'] <= time();
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/models/FrmMigrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,7 @@ private function check_that_tables_exist() {
*/
public function collation() {
global $wpdb;

if ( ! $wpdb->has_cap( 'collation' ) ) {
return '';
}

return $wpdb->get_charset_collate();
return $wpdb->has_cap( 'collation' ) ? $wpdb->get_charset_collate() : '';
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/models/FrmSpamCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ public function is_spam() {

$is_spam = $this->check();

if ( ! $is_spam ) {
return false;
}

return $this->get_spam_message();
return $is_spam ? $this->get_spam_message() : false;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/models/FrmSpamCheckDenylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,7 @@ protected function get_denylist_ips() {
* @return bool
*/
public function check() {
if ( $this->check_ip() ) {
return true;
}

return $this->check_values();
return $this->check_ip() ? true : $this->check_values();
}

/**
Expand Down
5 changes: 1 addition & 4 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ public function __construct( $field = 0, $type = '' ) {
* @return string
*/
public function __get( $key ) {
if ( property_exists( $this, $key ) ) {
return $this->{$key};
}
return '';
return property_exists( $this, $key ) ? $this->{$key} : '';
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/views/styles/components/FrmSliderStyleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ private function detect_unit_measurement( $value = null ) {
return 'em';
}

if ( preg_match( '/px$/', $value ) ) {
return 'px';
}

return '';
return preg_match( '/px$/', $value ) ? 'px' : '';
}

/**
Expand Down
Loading