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
7 changes: 1 addition & 6 deletions classes/controllers/FrmAddonsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,12 +1339,7 @@ public static function can_install_addon_api() {

// Verify auth.
$auth = get_option( 'frm_connect_token' );

if ( empty( $auth ) || ! hash_equals( $auth, $post_auth ) ) {
return false;
}

return true;
return ! empty( $auth ) && hash_equals( $auth, $post_auth );
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1443,12 +1443,7 @@ private static function in_our_pages() {
if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) {
return true;
}

if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) {
return true;
}

return false;
return in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' );
}

/**
Expand Down
12 changes: 2 additions & 10 deletions classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,7 @@ private static function view_args_entries_placeholder( $forms_count ) {
* @return array
*/
public static function display_counter_cta( $counter_type, $counter_value, $latest_available_form = false ) {
if ( $counter_value > 0 || ( 'entries' === $counter_type && false === $latest_available_form ) ) {
return false;
}

return true;
return $counter_value <= 0 && ! ( 'entries' === $counter_type && false === $latest_available_form );
}

/**
Expand Down Expand Up @@ -369,11 +365,7 @@ public static function entries_columns( $columns = array() ) {
public static function welcome_banner_has_closed() {
$user_id = get_current_user_id();
$banner_closed_by_users = self::get_closed_welcome_banner_user_ids();

if ( ! empty( $banner_closed_by_users ) && in_array( $user_id, $banner_closed_by_users, true ) ) {
return true;
}
return false;
return ! empty( $banner_closed_by_users ) && in_array( $user_id, $banner_closed_by_users, true );
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/helpers/FrmApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ public static function is_for_user( $item ) {
if ( in_array( 'free_not_first_30', $who, true ) && self::is_free_not_first_30() ) {
return true;
}

if ( self::check_free_segments( $who ) ) {
return true;
}
return false;
return self::check_free_segments( $who );
}

/**
Expand Down
9 changes: 2 additions & 7 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4812,13 +4812,8 @@ public static function validate_url_is_in_s3_bucket( $url, $expected_extension )

$path = $parsed['path'];
$ext = pathinfo( $path, PATHINFO_EXTENSION );

if ( $expected_extension !== $ext ) {
// The URL isn't to an XML file.
return false;
}

return true;
// The URL isn't to an XML file.
return $expected_extension === $ext;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/helpers/FrmFormMigratorsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ private static function is_dismissed( $form, $dismissed = null ) {
if ( $dismissed === null ) {
$dismissed = get_option( 'frm_dismissed' );
}

if ( ! empty( $dismissed ) && in_array( $form['class'], $dismissed ) ) {
return true;
}

return false;
return ! empty( $dismissed ) && in_array( $form['class'], $dismissed );
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/helpers/FrmFormsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2118,12 +2118,7 @@ private static function is_gutenberg_editor() {
}

global $pagenow;

if ( 'post.php' === $pagenow ) {
return true;
}

return false;
return 'post.php' === $pagenow;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/models/FrmApplicationTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,7 @@ private function is_available_for_purchase() {
'license_type' => $license_type,
'plan_required' => $this->get_required_license(),
);

if ( ! FrmFormsHelper::plan_is_allowed( $args ) ) {
return false;
}

return true;
return FrmFormsHelper::plan_is_allowed( $args );
}

/**
Expand Down
5 changes: 1 addition & 4 deletions classes/models/FrmEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,7 @@ public function should_send() {
* @return bool
*/
private function has_recipients() {
if ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) ) {
return false;
}
return true;
return ! ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) );
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/models/FrmEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,7 @@ private static function is_duplicate_check_needed( $values, $duplicate_entry_tim
}

// If repeating field entries are getting created, don't check for duplicates
if ( isset( $values['parent_form_id'] ) && $values['parent_form_id'] ) {
return false;
}

return true;
return empty( $values['parent_form_id'] );
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/models/FrmStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,7 @@ private function should_remove_every_brace( $setting ) {
// Matches size values but also checks for unexpected ( and ).
// This is case insensitive so it will catch PX, PT, etc, as well.
$looks_like_a_size = preg_match( '/\(?[+-]?\d*\.?\d+(?:px|%|em|rem|ex|pt|pc|mm|cm|in)\)?/i', $setting );

if ( $looks_like_a_size ) {
return true;
}

return false;
return (bool) $looks_like_a_size;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1782,11 +1782,7 @@ protected function should_strip_most_html( $entry ) {
if ( ! empty( $entry->updated_by ) && $this->user_id_is_privileged( $entry->updated_by ) ) {
return false;
}

if ( ! empty( $entry->user_id ) && $this->user_id_is_privileged( $entry->user_id ) ) {
return false;
}
return true;
return empty( $entry->user_id ) || ! $this->user_id_is_privileged( $entry->user_id );
}

/**
Expand Down
7 changes: 1 addition & 6 deletions classes/views/styles/components/FrmStyleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,7 @@ protected function hide_component() {
if ( empty( $this->data['not_show_in'] ) ) {
return false;
}

if ( FrmAppHelper::get_param( 'section', '', 'get', 'sanitize_text_field' ) === $this->data['not_show_in'] ) {
return true;
}

return false;
return FrmAppHelper::get_param( 'section', '', 'get', 'sanitize_text_field' ) === $this->data['not_show_in'];
}

/**
Expand Down
2 changes: 0 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
Expand Down Expand Up @@ -84,7 +83,6 @@
SimplifyEmptyCheckOnEmptyArrayRector::class,
CountArrayToEmptyArrayComparisonRector::class,
DisallowedEmptyRuleFixerRector::class,
SimplifyIfReturnBoolRector::class,
LocallyCalledStaticMethodToNonStaticRector::class,
// This changes \t to an actual tab character. We don't want this rule.
JoinStringConcatRector::class,
Expand Down
14 changes: 2 additions & 12 deletions stripe/models/FrmStrpLiteAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,7 @@ private static function statement_descriptor_is_valid( &$name ) {
if ( strlen( $name ) > 22 ) {
$name = substr( $name, 0, 22 );
}

if ( ! preg_match( '/^[a-zA-Z0-9\s\p{P}]+$/', $name ) ) {
return false;
}

return true;
return (bool) preg_match( '/^[a-zA-Z0-9\s\p{P}]+$/', $name );
}

/**
Expand Down Expand Up @@ -865,12 +860,7 @@ public static function payment_failed( $payment, $intent ) {
if ( self::intent_has_failed_status( $intent ) ) {
return true;
}

// The $intent will be "succeeded" with a failed payment when testing with the 4000000000000341 credit card.
if ( 'payment_failed' === FrmAppHelper::simple_get( 'frm_link_error' ) && 'failed' === $payment->status ) {
return true;
}

return false;
return 'payment_failed' === FrmAppHelper::simple_get( 'frm_link_error' ) && 'failed' === $payment->status;
}
}