Everywhere yoda conditions are
This commit is contained in:
@ -88,7 +88,7 @@ class Account_Summary_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-call-to-action';
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ abstract class Base_Element {
|
||||
*/
|
||||
protected function maybe_extract_arguments($content, $type = 'shortcode') {
|
||||
|
||||
if ($type === 'shortcode') {
|
||||
if ('shortcode' === $type) {
|
||||
|
||||
/**
|
||||
* Tries to parse the shortcode out of the content
|
||||
@ -539,7 +539,7 @@ abstract class Base_Element {
|
||||
preg_match_all('/' . $shortcode_regex . '/', $content, $matches, PREG_SET_ORDER);
|
||||
|
||||
return ! empty($matches) ? shortcode_parse_atts($matches[0][3]) : false;
|
||||
} elseif ($type === 'block') {
|
||||
} elseif ('block' === $type) {
|
||||
|
||||
/**
|
||||
* Next, try to parse attrs from blocks
|
||||
@ -818,7 +818,7 @@ abstract class Base_Element {
|
||||
|
||||
$value = wu_get_isset($saved_settings, $field_slug, null);
|
||||
|
||||
if ($value !== null) {
|
||||
if (null !== $value) {
|
||||
$field['value'] = $value;
|
||||
}
|
||||
}
|
||||
@ -886,7 +886,7 @@ abstract class Base_Element {
|
||||
foreach ($fields as $field_slug => $field) {
|
||||
$setting = wu_request($field_slug, false);
|
||||
|
||||
if ($setting !== false || $field['type'] === 'toggle') {
|
||||
if (false !== $setting || $field['type'] === 'toggle') {
|
||||
$settings[ $field_slug ] = $setting;
|
||||
}
|
||||
}
|
||||
@ -1055,7 +1055,7 @@ abstract class Base_Element {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( ! $screen || $screen_id !== $screen->id) {
|
||||
if ( ! $screen || $screen->id !== $screen_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Billing_Info_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class Checkout_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-cart-medium';
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ class Checkout_Element extends Base_Element {
|
||||
return is_string($bypass) ? $bypass : '';
|
||||
}
|
||||
|
||||
if ($customer && $membership && $slug !== 'wu-finish-checkout') {
|
||||
if ($customer && $membership && 'wu-finish-checkout' !== $slug) {
|
||||
$published_sites = $membership->get_published_sites();
|
||||
|
||||
$pending_payment = $membership ? $membership->get_last_pending_payment() : false;
|
||||
@ -493,7 +493,7 @@ class Checkout_Element extends Base_Element {
|
||||
$message .= "<a class=\"wu-no-underline button button-primary wu-mr-2\" href=\"$register_page\">$button_text</a>";
|
||||
}
|
||||
|
||||
if ($limitation !== 'sites' || wu_get_setting('enable_multiple_sites')) {
|
||||
if ('sites' !== $limitation || wu_get_setting('enable_multiple_sites')) {
|
||||
$update_link = '';
|
||||
|
||||
$checkout_pages = \WP_Ultimo\Checkout\Checkout_Pages::get_instance();
|
||||
@ -536,7 +536,7 @@ class Checkout_Element extends Base_Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ( ! $customer && $slug === 'wu-finish-checkout') {
|
||||
} elseif ( ! $customer && 'wu-finish-checkout' === $slug) {
|
||||
if (is_user_logged_in()) {
|
||||
$message = __('You need to be the account owner to complete this payment.', 'wp-ultimo');
|
||||
} else {
|
||||
@ -774,10 +774,12 @@ class Mocked_Signup {
|
||||
* @var string
|
||||
*/
|
||||
public $step;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $steps;
|
||||
|
||||
/**
|
||||
* Constructs the class.
|
||||
*
|
||||
@ -801,6 +803,7 @@ class Mocked_Signup {
|
||||
|
||||
return $this->steps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: returns the prev step link.
|
||||
*
|
||||
|
@ -101,6 +101,7 @@ class Current_Membership_Element extends Base_Element {
|
||||
|
||||
add_wubox();
|
||||
}
|
||||
|
||||
/**
|
||||
* The icon of the UI element.
|
||||
* e.g. return fa fa-search
|
||||
@ -110,7 +111,7 @@ class Current_Membership_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Current_Site_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class Domain_Mapping_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-url';
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ class Domain_Mapping_Element extends Base_Element {
|
||||
|
||||
$current_site = wu_get_site($current_site_id);
|
||||
|
||||
if ( ! is_super_admin() && (! $current_site || $current_user_id !== $current_site->get_customer()->get_user_id())) {
|
||||
if ( ! is_super_admin() && (! $current_site || $current_site->get_customer()->get_user_id() !== $current_user_id)) {
|
||||
wp_send_json_error(
|
||||
new \WP_Error('no-permissions', __('You do not have permissions to perform this action.', 'wp-ultimo'))
|
||||
);
|
||||
|
@ -243,27 +243,27 @@ class Field implements \JsonSerializable {
|
||||
$attr = call_user_func($attr, $this);
|
||||
}
|
||||
|
||||
if ($att === 'wrapper_classes' && isset($this->atts['wrapper_html_attr']['v-show'])) {
|
||||
$this->atts['wrapper_classes'] = $this->atts['wrapper_classes'] . ' wu-requires-other';
|
||||
if ('wrapper_classes' === $att && isset($this->atts['wrapper_html_attr']['v-show'])) {
|
||||
$this->atts['wrapper_classes'] .= ' wu-requires-other';
|
||||
}
|
||||
|
||||
if ($att === 'type' && $this->atts[ $att ] === 'submit') {
|
||||
$this->atts['wrapper_classes'] = $this->atts['wrapper_classes'] . ' wu-submit-field';
|
||||
if ('type' === $att && $this->atts[ $att ] === 'submit') {
|
||||
$this->atts['wrapper_classes'] .= ' wu-submit-field';
|
||||
}
|
||||
|
||||
if ($att === 'type' && $this->atts[ $att ] === 'tab-select') {
|
||||
$this->atts['wrapper_classes'] = $this->atts['wrapper_classes'] . ' wu-tab-field';
|
||||
if ('type' === $att && $this->atts[ $att ] === 'tab-select') {
|
||||
$this->atts['wrapper_classes'] .= ' wu-tab-field';
|
||||
}
|
||||
|
||||
if ($att === 'wrapper_classes' && is_a($this->form, '\\WP_Ultimo\\UI\\Form')) {
|
||||
if ('wrapper_classes' === $att && is_a($this->form, '\\WP_Ultimo\\UI\\Form')) {
|
||||
return $this->form->field_wrapper_classes . ' ' . $this->atts['wrapper_classes'];
|
||||
}
|
||||
|
||||
if ($att === 'classes' && is_a($this->form, '\\WP_Ultimo\\UI\\Form')) {
|
||||
if ('classes' === $att && is_a($this->form, '\\WP_Ultimo\\UI\\Form')) {
|
||||
return $this->form->field_classes . ' ' . $this->atts['classes'];
|
||||
}
|
||||
|
||||
if ($att === 'title' && $attr === false && isset($this->atts['name'])) {
|
||||
if ('title' === $att && false === $attr && isset($this->atts['name'])) {
|
||||
$attr = $this->atts['name'];
|
||||
}
|
||||
|
||||
@ -342,6 +342,7 @@ class Field implements \JsonSerializable {
|
||||
$this->value = call_user_func($sanitize_method, $this->value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitization callback for fields of type number.
|
||||
*
|
||||
|
@ -64,7 +64,7 @@ class Invoices_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-price-list';
|
||||
}
|
||||
|
||||
|
@ -237,6 +237,7 @@ class Jumper {
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the trigger key defined by the user.
|
||||
*
|
||||
@ -355,6 +356,7 @@ class Jumper {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full page URL for admin pages.
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ class Limits_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-skill-bar';
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Login_Form_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-lock-user';
|
||||
}
|
||||
|
||||
@ -505,16 +505,16 @@ class Login_Form_Element extends Base_Element {
|
||||
$redirect_type = wu_request('wu_login_form_redirect_type', 'default');
|
||||
|
||||
// If some condition match, force user redirection to the URL
|
||||
if ($redirect_type === 'query_redirect') {
|
||||
if ('query_redirect' === $redirect_type) {
|
||||
|
||||
// query_redirect is the default wp behaviour
|
||||
return $redirect_to;
|
||||
} elseif ($redirect_type === 'customer_site') {
|
||||
} elseif ('customer_site' === $redirect_type) {
|
||||
$user_site = get_active_blog_for_user($user->ID);
|
||||
|
||||
wp_redirect($user_site->siteurl . $requested_redirect_to);
|
||||
exit;
|
||||
} elseif ($redirect_type === 'main_site') {
|
||||
} elseif ('main_site' === $redirect_type) {
|
||||
wp_redirect(network_site_url($requested_redirect_to));
|
||||
exit;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class My_Sites_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ class My_Sites_Element extends Base_Element {
|
||||
);
|
||||
}
|
||||
|
||||
if ($show === 'all') {
|
||||
if ('all' === $show) {
|
||||
$wp_user_sites = get_blogs_of_user(get_current_user_id());
|
||||
|
||||
$user_sites = array_reduce(
|
||||
@ -372,6 +372,7 @@ class My_Sites_Element extends Base_Element {
|
||||
$wu_site->set_membership_id(0);
|
||||
$user_sites[ $wp_site->userblog_id ] = $wu_site;
|
||||
}
|
||||
|
||||
return $user_sites;
|
||||
}
|
||||
);
|
||||
@ -401,11 +402,11 @@ class My_Sites_Element extends Base_Element {
|
||||
*/
|
||||
public function get_manage_url($site_id, $type = 'default', $custom_page_id = 0) {
|
||||
|
||||
if ($type === 'wp_admin') {
|
||||
if ('wp_admin' === $type) {
|
||||
return get_admin_url($site_id);
|
||||
}
|
||||
|
||||
if ($type === 'custom_page') {
|
||||
if ('custom_page' === $type) {
|
||||
$custom_page = get_page_link($custom_page_id);
|
||||
|
||||
$url_param = \WP_Ultimo\Current::param_key('site');
|
||||
|
@ -48,7 +48,7 @@ class Payment_Methods_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Simple_Text_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-lock-user';
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ class Site_Actions_Element extends Base_Element {
|
||||
|
||||
add_wubox();
|
||||
}
|
||||
|
||||
/**
|
||||
* The icon of the UI element.
|
||||
* e.g. return fa fa-search
|
||||
@ -84,7 +85,7 @@ class Site_Actions_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Site_Maintenance_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block') {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-lock-user';
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ class Template_Previewer {
|
||||
$settings = $this->get_settings();
|
||||
|
||||
foreach ($settings as $setting => $value) {
|
||||
if ($setting === 'logo_url') {
|
||||
if ('logo_url' === $setting) {
|
||||
$settings['logo_url'] = wu_get_network_logo();
|
||||
|
||||
continue;
|
||||
|
@ -67,7 +67,7 @@ class Template_Switching_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-cart-medium';
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Thank_You_Element extends Base_Element {
|
||||
*/
|
||||
public function get_icon($context = 'block'): string {
|
||||
|
||||
if ($context === 'elementor') {
|
||||
if ('elementor' === $context) {
|
||||
return 'eicon-info-circle-o';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user