Everywhere yoda conditions are

This commit is contained in:
David Stone
2025-02-09 00:20:10 -07:00
parent d74f6d1a53
commit be0ab98895
213 changed files with 691 additions and 412 deletions

View File

@ -224,7 +224,7 @@ abstract class Base_Signup_Field {
$width = (int) wu_get_isset($this->attributes, 'width');
if ($width) {
if ($width !== 100) {
if (100 !== $width) {
$styles[] = 'float: left';
$styles[] = sprintf('width: %s%%', $width);
@ -332,7 +332,7 @@ abstract class Base_Signup_Field {
$field['default'] = wu_get_isset($this->defaults(), $key, '');
if ($value === null) {
if (null === $value) {
$value = $field['default'];
}

View File

@ -201,7 +201,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
$value = $this->get_value();
if ($value !== '' && (bool) $value === true) {
if ('' !== $value && (bool) $value === true) {
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
}

View File

@ -33,6 +33,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
return 'order_summary';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -81,6 +82,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
return __('Adds a summary table with prices, key subscription dates, discounts, and taxes.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*

View File

@ -33,6 +33,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
return 'period_selection';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -81,6 +82,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
return __('Adds a period selector, that allows customers to switch between different billing periods.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*
@ -285,7 +287,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
if (wu_get_isset($attributes, 'period_selection_template') === 'legacy') {
if ('legacy' === wu_get_isset($attributes, 'period_selection_template')) {
wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), ['wu-functions'], wu_get_version());
wp_enqueue_script('wu-legacy-signup');

View File

@ -33,6 +33,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
return 'pricing_table';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -81,6 +82,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
return __('Adds a pricing table section that customers can use to choose a plan to subscribe to.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*
@ -244,7 +246,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
*/
public function to_fields_array($attributes) {
if (wu_get_isset($attributes, 'pricing_table_template') === 'legacy') {
if ('legacy' === wu_get_isset($attributes, 'pricing_table_template')) {
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons'], wu_get_version());
wp_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());

View File

@ -32,6 +32,7 @@ class Signup_Field_Products extends Base_Signup_Field {
return 'products';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -80,6 +81,7 @@ class Signup_Field_Products extends Base_Signup_Field {
return __('Hidden field used to pre-select products. This is useful when you have a signup page for specific offering/bundles and do not want your customers to be able to choose plans and products manually.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*

View File

@ -32,6 +32,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
return 'shortcode';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -80,6 +81,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
return __('Displays the content of a given WordPress shortcode. Can be useful to insert content from other plugins inside a WP Multisite WaaS checkout form.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*

View File

@ -32,6 +32,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
return 'site_url';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -41,6 +42,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
return false;
}
/**
* Defines if this field/element is related to site creation or not.
*
@ -89,6 +91,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
return __('Adds a Site URL field. This is used to set the URL of the site being created.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*
@ -362,6 +365,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
return $checkout_fields;
}
/**
* Get the domain options.
*

View File

@ -33,6 +33,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
return 'steps';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -81,6 +82,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
return __('Adds a list of the steps.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*

View File

@ -34,6 +34,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
return 'template_selection';
}
/**
* Returns if this field should be present on the checkout flow or not.
*
@ -82,6 +83,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
return __('Adds a template selection section. This allows the customer to choose a pre-built site to be used as a template for the site being currently created.', 'wp-ultimo');
}
/**
* Returns the icon to be used on the selector.
*
@ -375,15 +377,15 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
$selection_type = wu_get_isset($attributes, 'template_selection_type', 'name');
if ($selection_type === 'name') {
if ('name' === $selection_type) {
return explode(',', $attributes['template_selection_sites']);
}
if ($selection_type === 'all') {
if ('all' === $selection_type) {
return wu_get_site_templates(['fields' => 'blog_id']);
}
if ($selection_type === 'categories') {
if ('categories' === $selection_type) {
return array_column(
\WP_Ultimo\Models\Site::get_all_by_categories(
$attributes['template_selection_categories'],

View File

@ -29,6 +29,7 @@ class Base_Field_Template {
* @var string
*/
protected $id;
/**
* @var array
*/
@ -92,6 +93,7 @@ class Base_Field_Template {
return __('Description', 'wp-ultimo');
}
/**
* The preview image of the field template.
*