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
14 changes: 7 additions & 7 deletions classes/helpers/FrmFieldGridHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct( $nested = false ) {
public function set_field( $field ) {
$this->field = $field;

if ( ! empty( $this->section_helper ) && 'end_divider' !== $field->type ) {
if ( $this->section_helper && 'end_divider' !== $field->type ) {
$this->section_helper->set_field( $field );
return;
}
Expand All @@ -93,7 +93,7 @@ public function set_field( $field ) {
$this->active_field_size = self::get_size_of_class( $this->field_layout_class );
}

if ( 'divider' !== $field->type || ! empty( $this->nested ) ) {
if ( 'divider' !== $field->type || $this->nested ) {
return;
}

Expand All @@ -106,7 +106,7 @@ public function set_field( $field ) {
* @return void
*/
private function maybe_close_section_helper() {
if ( empty( $this->section_helper ) ) {
if ( ! $this->section_helper ) {
return;
}
$this->section_helper->force_close_field_wrapper();
Expand Down Expand Up @@ -148,7 +148,7 @@ public function maybe_begin_field_wrapper() {
$this->begin_field_wrapper();
}

if ( ! empty( $this->section_helper ) && $this->section_is_open ) {
if ( $this->section_helper && $this->section_is_open ) {
$this->section_helper->maybe_begin_field_wrapper();
}
}
Expand All @@ -157,7 +157,7 @@ public function maybe_begin_field_wrapper() {
* @return bool
*/
private function should_first_close_the_active_field_wrapper() {
if ( false === $this->parent_li || ! empty( $this->section_helper ) ) {
if ( false === $this->parent_li || $this->section_helper ) {
return false;
}

Expand Down Expand Up @@ -215,15 +215,15 @@ private static function get_size_of_class( $class ) {
* @return void
*/
public function sync_list_size() {
if ( empty( $this->field ) ) {
if ( ! $this->field ) {
return;
}

if ( 'divider' === $this->field->type ) {
$this->section_is_open = true;
}

if ( ! empty( $this->section_helper ) ) {
if ( $this->section_helper ) {
$this->section_helper->sync_list_size();

if ( 'end_divider' === $this->field->type ) {
Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ protected function bulk_actions( $which = '' ) {
$two = '2';
}//end if

if ( empty( $this->_actions ) ) {
if ( ! $this->_actions ) {
return;
}

Expand Down Expand Up @@ -617,7 +617,7 @@ protected function get_items_per_page( $option, $default = 20 ) {
* @param string $which
*/
protected function pagination( $which ) {
if ( empty( $this->_pagination_args ) ) {
if ( ! $this->_pagination_args ) {
return;
}

Expand Down
16 changes: 8 additions & 8 deletions classes/models/FrmAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class FrmAddon {
protected $should_clear_cache = true;

public function __construct() {
if ( empty( $this->plugin_slug ) ) {
if ( ! $this->plugin_slug ) {
$this->plugin_slug = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->plugin_name ) ) );
}

if ( empty( $this->option_name ) ) {
if ( ! $this->option_name ) {
$this->option_name = 'edd_' . $this->plugin_slug . '_license_';
}

Expand Down Expand Up @@ -480,16 +480,16 @@ public function maybe_show_license_message( $file, $plugin ) {
public function show_license_message( $file, $plugin ) {
$message = '';

if ( empty( $this->license ) ) {
/* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
$message = sprintf( esc_html__( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), esc_html( $this->plugin_name ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">', '</a>' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
} else {
if ( $this->license ) {
$api = new FrmFormApi( $this->license );
$errors = $api->error_for_license();

if ( $errors ) {
$message = reset( $errors );
}
} else {
/* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
$message = sprintf( esc_html__( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), esc_html( $this->plugin_name ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">', '</a>' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
}

if ( ! $message ) {
Expand Down Expand Up @@ -680,7 +680,7 @@ private function cleared_plugins() {
* @return void
*/
private function is_license_revoked() {
if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( ! $this->license || ! $this->plugin_slug || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
return;
}

Expand Down Expand Up @@ -876,7 +876,7 @@ private function get_license_status() {
'error' => true,
);

if ( empty( $this->license ) ) {
if ( ! $this->license ) {
$response['error'] = false;
return $response;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmCreateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private function get_ftp_creds( $type ) {
* @return void
*/
private function show_error_message() {
if ( ! empty( $this->error_message ) ) {
if ( $this->error_message ) {
echo '<div class="message">' . esc_html( $this->error_message ) . '</div>';
}
}
Expand Down
8 changes: 4 additions & 4 deletions classes/models/FrmEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function set_to( $user_id_args ) {

$this->to = array_unique( (array) $to );

if ( empty( $this->to ) ) {
if ( ! $this->to ) {
return;
}

Expand Down Expand Up @@ -511,7 +511,7 @@ public function should_send() {
* @return bool
*/
private function has_recipients() {
return ! ( empty( $this->to ) && empty( $this->cc ) && empty( $this->bcc ) );
return $this->to || $this->cc || $this->bcc;
}

/**
Expand Down Expand Up @@ -586,11 +586,11 @@ private function send_single( $recipient ) {
private function package_header() {
$header = array();

if ( ! empty( $this->cc ) ) {
if ( $this->cc ) {
$header[] = 'CC: ' . implode( ',', $this->cc );
}

if ( ! empty( $this->bcc ) ) {
if ( $this->bcc ) {
$header[] = 'BCC: ' . implode( ',', $this->bcc );
}

Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmEntryShortcodeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct( $form_id, $atts ) {
$this->init_form_id( $form_id );
$this->init_fields();

if ( empty( $this->fields ) ) {
if ( ! $this->fields ) {
return;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ protected function init_table_generator() {
* @return array|string
*/
public function content() {
if ( ! $this->form_id || empty( $this->fields ) ) {
if ( ! $this->form_id || ! $this->fields ) {
return '';
}

Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmEntryValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ public function get_user_info() {
protected function is_field_included( $field ) {
$is_included = true;

if ( ! empty( $this->include_fields ) ) {
if ( $this->include_fields ) {
$is_included = $this->is_field_in_array( $field, $this->include_fields );
}

if ( ! empty( $this->exclude_fields ) ) {
if ( $this->exclude_fields ) {
$is_excluded = $this->is_field_in_array( $field, $this->exclude_fields );

if ( $is_excluded ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFieldFormHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ private function replace_required_class() {
* @return void
*/
private function replace_form_shortcodes() {
if ( ! empty( $this->form ) ) {
if ( $this->form ) {
$form = (array) $this->form;

// Replace [form_key].
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFieldValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ protected function clean_saved_value() {
FrmFieldsHelper::prepare_field_value( $this->saved_value, $field_type );
}

if ( is_array( $this->saved_value ) && empty( $this->saved_value ) ) {
if ( is_array( $this->saved_value ) && ! $this->saved_value ) {
$this->saved_value = '';
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFieldValueSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ protected function display_dropdown() {
echo '<select name="' . esc_attr( $this->html_name ) . '">';
echo '<option value="">' . esc_html( $this->blank_option_label ) . '</option>';

if ( ! empty( $this->options ) ) {
if ( $this->options ) {
$truncate = $this->truncate ?? 25;

foreach ( $this->options as $key => $value ) {
Expand Down
10 changes: 5 additions & 5 deletions classes/models/FrmFormApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function get_license() {
* @return void
*/
protected function set_cache_key() {
$this->cache_key = 'frm_addons_l' . ( empty( $this->license ) ? '' : md5( $this->license ) );
$this->cache_key = 'frm_addons_l' . ( $this->license ? md5( $this->license ) : '' );
}

/**
Expand Down Expand Up @@ -112,7 +112,7 @@ public function force_api_request() {
public function get_api_info() {
$url = $this->api_url();

if ( ! empty( $this->license ) ) {
if ( $this->license ) {
$url .= '?l=' . urlencode( base64_encode( $this->license ) );
}

Expand Down Expand Up @@ -235,7 +235,7 @@ protected function done_running() {
* @return bool
*/
protected function run_as_multisite() {
return is_multisite() && empty( $this->license );
return is_multisite() && ! $this->license;
}

/**
Expand All @@ -253,7 +253,7 @@ protected function transient_key() {
* @return string
*/
protected function api_url() {
if ( empty( $this->license ) ) {
if ( ! $this->license ) {
// Direct traffic to Cloudflare worker when there is no license.
return 'https://plapi.formidableforms.com/list/';
}
Expand Down Expand Up @@ -490,7 +490,7 @@ public function reset_cached() {
* @return array
*/
public function error_for_license() {
if ( ! empty( $this->license ) ) {
if ( $this->license ) {
return $this->get_error_from_response();
}
return array();
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFormMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ protected function prepare_fields( $fields, &$form ) {

$this->prepare_field( $field, $new_field );

$in_section = ! empty( $this->current_section ) && ! in_array( $new_type, $this->fields_with_end(), true ) && $new_type !== 'break';
$in_section = $this->current_section && ! in_array( $new_type, $this->fields_with_end(), true ) && $new_type !== 'break';

if ( $in_section ) {
$new_field['field_options']['in_section'] = $this->current_section['id'];
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ private function fill_captcha_settings() {
$re_lang = $recaptcha_opt['re_lang'] ?? $re_lang;
}

if ( empty( $this->re_msg ) ) {
if ( ! $this->re_msg ) {
$this->re_msg = __( 'The CAPTCHA was not entered correctly', 'formidable' );
}

Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmSolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class FrmSolution {
* @param array $atts
*/
public function __construct( $atts = array() ) {
if ( empty( $this->plugin_slug ) ) {
if ( ! $this->plugin_slug ) {
return;
}

add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
add_action( 'admin_init', array( $this, 'redirect' ), 9999 );

if ( empty( $this->plugin_file ) ) {
if ( ! $this->plugin_file ) {
$this->plugin_file = $this->plugin_slug . '.php';
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmTableHTMLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function init_table_style() {
$this->table_style .= ' class="' . esc_attr( $this->style_settings['class'] ) . '"';
}

if ( ! empty( $this->width ) ) {
if ( $this->width ) {
$this->table_style .= ' width="' . esc_attr( $this->width ) . '"';
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct( $form_id ) {
* @return object|null Form.
*/
protected function get_form() {
if ( empty( $this->form ) ) {
if ( ! $this->form ) {
$this->form = FrmForm::getOne( $this->form_id );
}
return $this->form;
Expand Down
6 changes: 3 additions & 3 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ public function __get( $key ) {
* @return void
*/
protected function set_type( $type ) {
if ( empty( $this->type ) ) {
if ( ! $this->type ) {
$this->type = $this->get_field_column( 'type' );

if ( empty( $this->type ) && $type ) {
if ( ! $this->type && $type ) {
$this->type = $type;
}
}
Expand All @@ -144,7 +144,7 @@ protected function set_type( $type ) {
* @return void
*/
protected function set_field_id() {
if ( empty( $this->field ) ) {
if ( ! $this->field ) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/views/styles/components/FrmStyleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private function get_component_attributes() {
* @return string
*/
private function get_field_name() {
return ! empty( $this->field_name ) ? 'name=' . $this->field_name : '';
return $this->field_name ? 'name=' . $this->field_name : '';
}

/**
Expand All @@ -212,7 +212,7 @@ private function set_view_path() {
* @return void
*/
protected function load_view() {
if ( empty( $this->view_name ) ) {
if ( ! $this->view_name ) {
return;
}

Expand Down
Loading
Loading